summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-29game: fix flashers list corruptionVito Caputo
(entity_t.flashes_remaining == 0) was being misused to indicate an entity wasn't on any of the flashers lists. At some point during the feature's development that was actually true, but as the code evolved that was no longer the case and entities would sit in the flashers_off list with flashes_remaining at 0 before flipping back on for a cycle at which point they'd be found with 0 flashes_remaining and dropped from any flashers lists. This is a problem because flash_entity() would come along and use the flashes_remaining == 0 state to see if the entity needed to get on a flashers list before resetting the flashes_remaining count. Furthermore, when adult->holding gets cleared (baby drop off) the flashes_remaining gets zeroed to ensure the reset baby doesn't start out with residual flashing at its new location. This just created more opportunities where the flashes_remaining is zero while still on a list, since the holding reset was just expediting the list removal - not actually doing it. This commit simply introduces a discrete flag for flashing vs. not flashing to indicate flashers_{on,off} list membership, independent of the flashes_remaining count. Fixes infinite loop / apparent freeze bug reported by Tara and Phil during some play testing. Thanks guys!
2022-11-29sars: default emscripten builds to fullscreenVito Caputo
Since emscripten builds are often run under a browser window, putting ourselves into fullscreen mode is most likely to get a filled-out canvas within the window we find ourselves in. It's really up to the emscripten runtime environment to deal with windowing vs. fullscreen handling in an appropriate manner. We can't really be bothered with that from the nested environment we find ourselves in there.
2022-11-29main: add emscripten main loop integrationVito Caputo
With emscripten builds we need to let emscripten own the main loop, hence why play_run_slice() was added. For non-emscripten builds nothing is different.
2022-11-29*: pivot everything to OpenGL ES 2.0Vito Caputo
In the interests of keeping things bisectable this is one big commit of everything necessary to go from OpenGL 2.1 to OpenGL ES 2.0 in one fell swoop. There's a handful of annoying mechanical changes necessary in shaders like removing the 'f' suffix on float constants e.g. 1.f becomes 1.0 etc. This is primarily happening to enable emscripten builds
2022-11-29libplay: bump libplay version for play_run_slice()Vito Caputo
Emscripten integration will want this function. A few mechanical changes required to catch up with upstream libplay API changes as well.
2022-11-27sars: chdir() to executable's base pathVito Caputo
On MacOS in particular it seems when executing sars via gui from the downloaded .zip the cwd isn't being set to the containing directory beforehand. This prevents the assets from being found at the correct location. With this commit SDL_GetBasePath() is used to try find the executable's containing directory. When successful, a chdir() is performed to this path in an effort to ensure the assets/ dir is where expected in relative terms. These are all done in a non-fatal best-effort fashion, simply warning when failed. An unfortunate side effect of this is when you're explicitly running sars from somewhere else with a different relative assets/ directory for development/testing purposes, it no longer uses the inherited cwd. Instead it will always move itself to wherever the executable resides. Maybe I'll add a flag for controlling this behavior. It's also unclear to me how safe assuming chdir() works will be vs. platforms supported by SDL2. Sure, chdir() is POSIX, but um, SDL2 speaks to supporting platforms like PSP and Android. I doubt chdir() is available everywhere, and I wonder why there's no SDL_chdir() in SDL_filesystem.h to hide this potential detail alongside the SDL_GetBasePath() abstraction.
2022-11-27game: flash some entitiesVito Caputo
- flash masked adult when hit by virus - flash held baby and teepee when teepee pickup blocked by held baby (and block teepee pickup when holding a baby)
2022-11-27game: rudimentary support for flashing entitiesVito Caputo
This just adds a basic flashing entity mechanism, but doesn't make anything actually flash yet. The intention is to make the adult flash briefly when hit by a virus while masked, and to flash a held baby and teepee when attempting to pickup the teepee while holding the baby.
2022-11-26game: play adult_mine.wav on mask pickups tooVito Caputo
It might make sense to have a separate .wav for this, but since I don't currently have anything to put there just use the same wav.
2022-11-26game: fix teepee icons grid offset to centerVito Caputo
The icons grid was shifted left slightly...
2022-11-26game: normalize all movementsVito Caputo
Until now keyboard movements could "cheat" by moving faster on the diagonals. Instead put all the movements through the same normalizing introduced by the touch handling.
2022-11-24game: tweak teepee powerup probabilitiesVito Caputo
lower likelihoods of the >1 quantities to make it a bit more difficult
2022-11-24game: make winning a proper state w/animationsVito Caputo
This makes hoarding 256 rolls explode the rolls then infinitely scroll+rotate them while showing the high score and waiting for keypress.
2022-11-22game: silence clang warning about implicit float conversionVito Caputo
just adding an explicit cast
2022-11-21game: fix error string typo s/unale/unable/Vito Caputo
2022-11-12libansr: bump submodule for header guard fixVito Caputo
unimportant but arguably hygienic
2022-11-10game: stub ou ta win condition on >256 TP rollsVito Caputo
For now this just does the same thing as dying, I need to either animate something interesting or add a .ans to show something celebratory like the monkey sitting on a mountain of TP.
2022-11-10game: add bonus nodes to teepee entitiesVito Caputo
This shows the teeepee quantity alongside the TP sprite, with a little fade+wiggle animation when the TP is collected.
2022-11-10bonus-node: add bonus node for bonus quantitiesVito Caputo
This shows a numeric display with an API for tracking a position until released. Once released the node self-animates and frees itself from its own rendering function. Post-release the node stops accessing the tracking position, intended for allowing the associated entity to become reused or discarded immediately upon release. For this to work smoothly the release must be accompanied by a storing of the last position within the bonus node via the provided pointer, which the bonus node's render function then uses as the origin of its self-animating before destruction. See comment at start of bonus-node.c for more information/issues. This only adds the node without integrating into the game, a subsequent commit will integrate into game.c. Initial impetus for adding this is making teepee quantities visible.
2022-11-10libstage: bump libstage for new render_funcVito Caputo
Newer libstage enables the render_func to free its stage node via return value. This is useful for fire-and-forget style ephemeral nodes that make for convenient autonomous stage nodes which remove themselves after running their course. Think bonus scores and little visual effects... Requires some mechanical changes to the existing render funcs, but nothing functionally has really changed.
2022-11-09game: add a variety of teepee powerup quantitiesVito Caputo
In the interests of making it realistically possible to completely fill the 256 spots of teepee icons as a winning condition, there's now mega packs of rolls. There will need to be some visible indication of qty added, either numerically or with different graphics. I'm leaning towards just adding numeric quantity values like +3 or +36 over the roll which floats away when you take it.
2022-11-09ansr-tex: open .ans files with "rb" to make windows happyVito Caputo
Windows builds were crashing after not even rendering the splash screen properly. Experience suggested this was probably the cause, and testing in WINE has at least seemed confirm the fix.
2022-11-08game: introduce toilet paper hoarding mechanicVito Caputo
for now toilet paper is simply picked up by the adult and accumulates as a pointless icon starting at the top left corner, potentially filling the entire screen with enough hoarding; obstructing the player's view of what's going on. There's no points added for hoarding, it's completely pointless and counterproductive.
2022-11-08teepee-node: introduce a teepee (toilet paper) nodeVito Caputo
preparatory commit for a toilet paper hoarding game mechanic
2022-11-08game: minor mask tweaksVito Caputo
- make mask protection additive rather than absolute, so you can accumulate mask hit points - raise the mask stage_t.layer 3->4 so it's less obscured
2022-11-08gfx: delete embedded RGBA gfx now that .ans is usedVito Caputo
simple removal of the now unused embedded assets
2022-11-08*-node: pivot to ansr_tex_new() and .ans assetsVito Caputo
This switches all existing art assets over to runtime-loaded-and-rendered .ans assets. gfx/*.h embedded assets will be removed in a subsequent commit
2022-11-08assets: check in the .ans and .mask.ans assetsVito Caputo
These are derived from the original release assets where possible. teepee.ans mask.ans are programmer art I slapped together, adult-mask.ans and baby-hatted.ans are derived from the release but modded quick and dirtily by myself.
2022-11-08ansr-tex: add .ans->cp437->tex_t ability via libansrVito Caputo
libansr is used to turn the ansi stream of bytes into an in-memory representation of the screen's character contents. From this in-memory representation (ansr_t) an RGBA pixel rendering is produced in the form of a uint32_t array. This is then uploaded to the GPU via the existing tex.[ch] api. The intention here is to replace all the compiled-in gfx/* RGBA buffers with runtime-loaded-and-rendered .and files read from the filesystem. This enables faster iteration on the art without involving recompilation, and smaller distribution of the builds. Nothing functionally changes with this commit yet. It's only introducing the functionality to the tree and adding it to the build. Subsequent commits will replace the various tex_new() callers in the various -node.c listings with ansr_tex_new() equivalents. Afterwards all of the headers in gfx/ will be removed in favor of .ans assets. One additional detail is there's now going to be a concept of mask.ans files for controlling the alpha, since .ans alone doesn't really suffice here. Some ansi editors use methods like space-padding from the left to place the actual content, and there's no obvious way to differentiate those space pads from desired opaque background color cells vs. just transparent locators. So a separate mask.ans is supported where every non-black pixel of the mask.ans will be opaque, and every black pixel transparent, in the final tex_t output.
2022-11-08libansr: build and link the libraryVito Caputo
adding the library to autotools
2022-11-08libix2: bump libix2 for depth deref precedence fixVito Caputo
2022-11-08libansr: add libansr submoduleVito Caputo
preparatory commit for using .ans files directly for sprites
2022-10-18game: introduce a mask powerupVito Caputo
baby vs. mask: baby steals and wears mask as useless hat, adult vs. mask: adult wears mask for 3 hits of virus protection virus vs. masked adult: decrements mask hit points virus vs. hatted baby: same as virus vs. unmasked baby TODO: - visible indication of how many remaining hits mask has - maybe blink mask when one hit remains - sfx for adult mask wearing and loss, baby mask stealing? - sfx for virus vs. mask?
2022-10-18gfx: add placeholder graphics for masked powerupVito Caputo
gfx-adult-masked: adult wearing mask gfx-baby-hatted: baby misusing mask as hat gfx-mask: the mask powerup itself This is a preparatory commit that doesn't actually change anything functionally, just to avoid having giant .h files in the powerup-adding commit.
2022-10-18tex-node: fix tex leakVito Caputo
This must have been introduced accidentally when rearranging the function. Fortunately tex_node_new_mem() isn't really used by anything except hungrycat.c so it's been relatively harmless.
2022-10-17sfx: add adult-captivated.wav sfx for adult meets tvVito Caputo
also s/frozen/captivated/ for consistency with sfx
2022-10-17hungrycat: skip hungrycat on {key,finger}downVito Caputo
splash screen bypasses for the impatient escape quits splash now as well
2022-10-17game: infect TV-attracted babies vs. static infectionsVito Caputo
Existing code wouldn't notice when a TV-attracted baby collided with an existing inanimate infection (previously infected baby) This commit adds a nested search in tv_search for the affected baby case, to detect such collisions. Note this required bumping the max nested search for the ix2 from 1 to 2, comment updated to reflect that.
2022-10-17game: propagate virus for newly infected babiesVito Caputo
The existing code wouldn't handle when newly infected babies overlapped with other uninfected babies, creating potential outcomes where a stationary virus is left visibly touching an uninfected baby. This commit puts new infections on a list to be processed like viruses after performing the per-virus search creating the new infections. Now when a newly infected baby is touching other babies, those other babies become immediately infected as well.
2022-10-17game: handle infecting multiple babies at onceVito Caputo
It's possible for babies to overlap and a virus to encounter them simultaneously. The existing code halted the search on the first hit. This commit changes things to continue the search and infect all hits before resetting the infecting virus.
2022-10-17game: add TV attraction of babiesVito Caputo
Now nearby babies migrate towards the TV
2022-10-17game: s/update_viruses/update_entities/Vito Caputo
This name already doesn't quite reflect what's happening since the addition of the TV. There will be more non-viruses stuff added to this function only making the existing name even more wrong. Renaming for better accuracy along with the associated timer's symbolic constants. No functional changes...
2022-10-10game: add rudimentary touch supportVito Caputo
When a touch is active, the player progresses towards the touch position. The scaling of the touch coordinates is a bit oversized so you can place the adult off-screen to rescue babies, without your finger actually going off-screen.
2022-10-10sars: add ndc->bpc conversion helpersVito Caputo
bpc = boxed projection coordinates, this basically comes from eon just like the pillar/letter boxing code for fullscreen stuff did. Previously I didn't need this part of that code, but the touch coordinates are in ndc and those need to get transformed by the projection transform's inverse.
2022-10-10m4f: fix typo in m4f_invert()Vito Caputo
I feel like I've re-fixed this a dozen times now in various projects because I haven't been submoduling m4f*.h
2021-12-26sars: collapse FULL+FILL cases in sars_winmode_set()Vito Caputo
Having these distinct is vestigial, they're no longer different so merge them. No functional difference.
2021-12-25*: introduce a projection matrix and winmodesrev3Vito Caputo
The bulk of this is mechanical wiring up of a projection_x to all the nodes. But this also introduces maintenance of the projection_x, with aspect-ratio preservation in two of the modes: WINDOWED and FULLSCREEN, with the previously default stretched-to-fill fullscreen mode now relegated to a third FILLSCREEN winmode. The default at startup is now an aspect ratio-preserving windowed mode. Simply press the 'f' key at any time to cycle through them. This was mostly done in sars to provide a source-available test for reproducing a fullscreen SDL2 bug I filed @ https://github.com/libsdl-org/SDL/issues/5139 Otherwise it's pretty silly to bother with doing anything on sars... but it is a handy little mule for such things.
2021-12-12README: update to reference builds and pouetVito Caputo
There was mention of an intention to add these in the README, but never followed up. Previously one had to find the pouet entry and follow the download link to find assets for a self-made build.
2020-05-30libstage: bump libstage versionVito Caputo
Newer libstage cleans up the parent/adopt conf naming a bit, fixup relevant call sites to reflect that.
2020-05-13game: simplify pad_free() usageVito Caputo
Cosmetic change getting rid of a FIXME from the code
© All Rights Reserved