Commit graph

3001 commits

Author SHA1 Message Date
Dav999
0b00415ab3 Add Persian to credits screen 2025-05-02 22:31:29 -04:00
Dav999
3eb88e0ac0 Add files for Persian localization
A bit overdue since this was delivered a few weeks ago (oops),
but here it is!

Thanks to Amir Arzani and Masoud Varaste.
2025-05-02 22:31:29 -04:00
NyakoFox
719ed9a67b Fix uncommon division-by-zero
Every now and then, the game crashes for me because of a division by
zero, due to the rect returned by `Graphics::get_stretch_info`. I don't
fully know how the width and height get set to 0, but this should
protect against it.

As I always use integer scaling, my guess is that
`Screen::GetScreenSize` (which later calls `SDL_GetRendererOutputSize`)
returns 0 sometimes, and the code trusts that -- but I know that
windows and things can be finicky, so the clamp is probably a good
idea.
2025-05-01 18:33:02 -04:00
NyakoFox
6810c5fa8c Fix #1223 (analogue mode segfault)
When `SDL_RenderReadPixels` fails for some reason, the game tries to
free the temporary source surface it creates. Unfortunately, it never
sets it to `NULL` after, so the next time the game tries to render the
filter, it'll try to work with a memory region that was already freed.

To fix this, I just replaced `SDL_FreeSurface(*src);` with
`VVV_freefunc(SDL_FreeSurface, *src);` which is a helper macro which
sets the pointer to NULL after freeing.

Now, there's a new issue -- since the temporary buffer is now NULL,
next frame we'll try to remake it! So I've introduced a static bool
which disables the filter entirely if `SDL_RenderReadPixels` fails.
Without this, it'd create and destroy a surface every frame, which
could lead to slowdown. (Not as slow as the filter when it DOES work,
but still...)

I also added a line which frees the second temporary surface... it's
weird that was missing in the first place, but I think reimplementing
analogue mode was one of the last things I did for the renderer
rewrite anyways.

Resolves #1223.
2025-04-29 20:54:11 -04:00
NyakoFox
2ee5aef3fa Fix the campaign trinket count missing from stats
PR #1226 tweaks both the crew and the stats screens. When there's no
trinkets in the level, it removes the trinket count from the STATS
screen in the menu. This, however, is missing a `custommode` check,
meaning that the main game is ALSO missing the trinket count.

This PR fixes that oversight.
2025-04-29 20:53:05 -04:00
NyakoFox
c1eaeca9f6 Fix "invalid" activity zones not spawning
There's a problem in #1224 where it breaks spawning custom activity
zones. After a bit of confusion after this was reported, I realized
that I removed the fallback from `getcrewman` and changed the return
value to `-1` if the entity isn't found, to avoid returning the wrong
entity (entity 0, aka probably the player).

Unfortunately, it seems like a ton of levels (including my older ones)
rely on this behavior.

Creating custom activity zones is a long process which uses a bunch of
unintended behaviour, which includes targeting a crewmate with color
35. With the change I mentioned earlier, the `getcrewman` function
would return `-1` instead, which was out of bounds of the entity array,
so the game avoided spawning the activity zone at all. The prior
behaviour of falling back to entity 0 (most likely the player) would
spawn the activity zone around the player instead.

Nowadays, I try to spawn a crewmate with color 35 anyways so I can
control where the box spawns (instead of on the player always), however
most people don't (and haven't) so reverting this change seems best for
now.

If we wanted to reintroduce the `-1` fallback in the future, things
that call `getcrewman` would have to check for `-1` and use `0`
instead, but that would require a lot more testing and studying where
it's used, and I'd rather squash this bug quickly and worry about
cleanliness later.
2025-04-28 08:04:51 -04:00
NyakoFox
0e9c4f98a6 Replace colour IDs with an enum
Entity colors are just integers. Their colour ID gets passed through a
big switch, returning different RGB values depending on the colour ID
(and can also get affected by randomness or other game state.)

But because of this, there's a bunch of random numbers floating around,
with no actual description on what they are other than comments which,
while most of the time are accurate, only exist in the switch.

To fix this, this commit adds a new enum which labels every colour.
While we can't use it as a type (as we need to allow colours outside of
what are defined, in case people want a "pure white", and scripting can
set any colour ID they want), colours have to stay as `int`.
2025-04-21 20:09:57 -04:00
NyakoFox
b8bcdf39df Move saving outside of MetaData (oops!) 2025-04-12 16:43:50 -04:00
NyakoFox
6809aa0135 Attempt to fix external playtesting not respecting colour 2025-04-12 16:43:50 -04:00
NyakoFox
5816e6f51a Add player colour as a level property
This PR adds a new XML property for the player's colour. It is 0 by
default, but you can change it to any colour ID. For example, making
the player use the trinket color is `<PlayerColour>3</PlayerColour>`.

This is mostly a quality-of-life addition, as the player's colour is
always 0 unless changed by scripts. A lot of levels which use different
player colours use an intro script which both changes the player's
colour and sets their respawn colour, which works great for finished,
completed levels, but makes playtesting a little more annoying as they
will spawn in as the wrong colour. Adding a level property for the
default player colour fixes this annoyance.

Additionally, this changes the behavior of `restoreplayercolour`. This
command used to set the player's colour to 0 (ignoring the respawn
colour, so when Viridian would die, they would revert to the respawn
colour). Now, it sets both Viridian's colour AND the respawn colour to
what was present in the level file. This way, you can temporarily
change the player colour using the script commands, and then use
`restoreplayercolour` to revert back to what the player colour
normally is.

The start point colour has also changed, to show the player colour
instead of always colour 0.

Like most changes like this, a way to change this in-editor does not
yet exist, but is planned for the future.
2025-04-12 16:43:50 -04:00
mothbeanie
b0d53e85a0
Crew screen tweaks for custom levels.
See #1226 for a full overview with comparison images.
2025-04-12 16:41:30 -04:00
NyakoFox
d419c6ed5b Remove extra unnecessary palettes
This merges the colors from other palettes into the general entity
palette function.
2025-02-18 14:14:16 -05:00
Dav999
343790f12b Change name of Silesian option (part 2)
Turns out there was a little miscommunication with the translator -
they said the option needed to say "Ślōnsko" but were only talking
about correcting the first word, where I thought the whole thing needed
to be replaced.
2025-02-18 09:51:40 -05:00
Dav999
e318df24bc Change name of Silesian option by request of translator
Our Silesian translator asked for "Ślonsko godka" to be changed to
"Ślōnsko".
2025-02-05 11:05:01 -05:00
Dav999
d709db4b45 Fix squeak and save spam in gamepad menu
If you push a button to set a controller binding, you may either hear
one Viridian squeak, two Viridian squeaks (a louder one), or Viridian
doesn't stop squeaking until you let go of the button. While you hear
the continuous squeaking, your save file is also repeatedly saved.

There are two small bugs at play here:
- the squeak is actually played in two different places at the same
  time (both in titleinput() whenever a button is pressed, and in
  updatebuttonmappings() when a mapping is succesfully changed)
- titleinput() doesn't register that a button is held down and applies
  the button (and saves to file) every frame for as long as the button
  is held

This commit fixes both these issues. Now a single button press always
causes one squeak, and only if the bindings actually changed. Your save
file is also no longer saved repeatedly from holding down the button.
2024-12-22 15:53:04 -05:00
mothbeanie
f9f9f076b4 musicVolume -> controlVolume for clarity 2024-12-17 09:52:06 -05:00
mothbeanie
d90f3c3c08 :3 2024-12-17 09:52:06 -05:00
mothbeanie
420683a80f introduce functions to modulate user volume 2024-12-17 09:52:06 -05:00
NyakoFox
d4e472db1b Make 0-length gravity lines invisible again 2024-11-17 11:46:24 -05:00
Ally
63880169e6
Convert entity types to an enum (#1007)
In an effort to remove magic numbers, I've given every entity type a
name. Hopefully I didn't miss anywhere.

Also, add `createentity` case 100 for backwards compatibility.

Co-authored-by: NyakoFox <nyakowofox@gmail.com>
Co-authored-by: Dav999 <dav999.tolp@gmail.com>
2024-11-17 11:45:57 -05:00
Reese Rivers
9c45dfb845 Tweak one word in the Esperanto localisation
"Rekordo" (record) flows better than "altpoentaro", which is a literal translation of "high score".
2024-11-15 21:22:01 -05:00
leo60228
fa8517a521
iOS port (for desktop_version) (#1137) 2024-11-15 20:33:10 -05:00
NyakoFox
6174d62f6f position(force) -> position(absolute) 2024-11-07 09:53:45 -08:00
NyakoFox
98a0931225 Add textoutline(on/off/default)
This commit adds a new scripting command for textbox visual control,
where you're able to force the transparent textbox's outline on or off.
2024-11-07 09:53:45 -08:00
NyakoFox
45e60fa69c Add position(force)
This argument forces the textbox position, meaning it won't be moved
to be inside of the bounds of the screen (nor have the 10 pixel padding
on each side.)
2024-11-07 09:53:45 -08:00
mothbeanie
d8a8e44afa fix flipped inequality sign
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
2024-11-03 21:54:44 -08:00
mothbeanie
b572e2164b fix flipped inequality sign
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
2024-11-03 21:54:44 -08:00
mothbeanie
2875af0492 Fix coordinates being allowed in the wrong order 2024-11-03 21:54:44 -08:00
mothbeanie
54b2aaae96 Region system PR review changes
Fixes errors or oversights with the region system for the PR review
2024-11-03 21:54:44 -08:00
mothbeanie
1fb0afb99d Apply PR review changes
Co-authored-by: Misa Elizabeth Kai <infoteddy@infoteddy.info>
2024-11-03 21:54:44 -08:00
mothbeanie
dedf941b25 Update region system to current codebase due to PR rot 2024-11-03 21:54:44 -08:00
Ethan Lee
94620d809e CI: Migrate to SLR Sniper SDK for Linux builds 2024-11-03 16:57:17 -08:00
leo60228
11d0e7f91e correctly set VVV_CXX_SRC flags (set_source_files_properties isn't cumulative) 2024-11-03 16:52:48 -08:00
leo60228
4587fa46b0 update android sdl2 to 2.30.8 2024-10-05 16:48:47 -04:00
NyakoFox
c2642dbdef Add more checks for checkpoint saving 2024-10-02 00:37:25 -07:00
Misa
a0bd2f3da4 Refactor: Use fullmap() everywhere
This replaces all instances of unlocking all rooms on the map with calls
to map.fullmap(), for consistency.

This also fixes two comments that got swapped around in startgamemode().
I don't know how that happened.

[skip ci]
2024-09-28 00:52:19 +00:00
mothbeanie
8a00ea7aab Add mapexplored(), mapreveal() commands 2024-09-27 17:47:19 -07:00
NyakoFox
c04c6bc552 Abstract checkpoint saving to its own function
This also makes the save failed textbox not appear in special modes,
and allows custom levels to quicksave from checkpoints as well.
2024-09-27 17:14:57 -07:00
NyakoFox
41d5e688e9 Fix menu option, show textbox when save failed
In my last commit, I accidentally inverted whether the description says
ON or OFF.
2024-09-27 17:14:57 -07:00
NyakoFox
e58fd606cf add menu option for checkpoint saving 2024-09-27 17:14:57 -07:00
NyakoFox
8aec83daec Checkpoint autosaving 2024-09-27 17:14:57 -07:00
Misa
c870df4e5b Remove slowdown during death animation
Some discussion on the Discord server resulted in this change. It's a
quality-of-life improvement where, if the game is in slowdown mode, it
will return to 100% speed for the duration of the death animation.

The reasoning is obvious. There is nothing to do during the death
animation, so making it take longer during slowdown is just an annoyance
to the player, almost a penalty for them using an accessibility option.
This is the same reason why slowdown no longer applies in menus, etc.
2024-09-25 21:14:02 -07:00
Misa
32562f03a9 Give MotU trophy in normal mode
This makes it so that it is possible to obtain the Master of the
Universe trophy/achievement, usually unlocked by beating No Death Mode,
outside of NDM.

There are several conditions that need to be met:

1. The game needs to be started from a new game and cannot be from
   loading a save.
2. Accessibility modes (invincibility and slowdown) must never be
   enabled.

If either condition is violated, then the boolean that keeps track of
NDM eligibility will be set to false.
2024-09-23 22:23:45 -07:00
NyakoFox
d8b2b3542a Add enemy speed as a room property
Currently, you can change platform speed, but not enemy speed, which is
always hardcoded to be 4. This commit fixes that, by adding the
"enemyv" property, which is an offset to the speed of 4. Since it
defaults to 0, older levels are not broken by this change.
2024-09-23 18:56:41 -07:00
Misa
8b62bb1d65 Bump version to v2.5
I consider the 2.4 development cycle over now, after the most important
bugs (and regressions) were fixed in 2.4.2.

[skip ci]
2024-08-27 15:13:24 -07:00
Dav999
149f5fbebc Tweak IME selection background left bound
Just extending the selection background left by one pixel so there's
not one pixel of black background to the left of a selection that
starts at the beginning of the text, and so some characters being
selected show up better (particularly where there's a long vertical bar
at the first pixel). We shouldn't be overlapping any part of the
previous character, since every character normally has a pixel of
spacing on the right.
2024-08-06 18:16:46 -07:00
Dav999
9ec8d8b637 Add selection background to IME rendering
Decided to implement it anyway since the broken behavior (selection
length always being 0, at least on Windows) may get fixed later in SDL,
so let's do it right in one go.
2024-08-02 22:25:00 -07:00
Dav999
8b8f827b70 Add IME text rendering
This shows the uncommitted text in a box in the bottom left corner.
This doesn't show the selection (defined by the start and length fields
in the event) yet, but this is already much better than it was on its
own, and I don't know how urgent the selection is since it's broken on
Windows anyway.
2024-08-02 22:25:00 -07:00
Dav999
a9ca63b367 Add buffer for IME editing events
When inputting uncommitted text from an IME, this is now stored in a
std::string imebuffer, just like keybuffer. It also enables extended
editing events, so text longer than what fits in the standard editing
event is also supported. This commit does not yet display the text
onscreen.
2024-08-02 22:25:00 -07:00
Misa
345eca5e10 Fix regression: Escape from conveyor spikes
This fixes a regression from 2.3. Consider the following diagram:

       CC
    X  CC
      <<<<

"C" indicates one tile of a checkpoint entity, "X" indicates a spike
tile, and "<" indicates one tile of a conveyor entity that has the
default speed (4 pixels per frame) going leftwards.

Now consider if the player were to touch the checkpoint and die. In 2.2,
they would be able to escape from the spike by holding right. But in
2.3, they would not be able to, and would die from the spike
continuously with no escape.

This happens because in 2.2, the player would spawn a couple pixels off
the surface, and this gained them an extra frame of movement to move
away from the conveyor. 2.3 places the player directly on the ground,
moving them one frame earlier and thus forcing them to their doom.

Now consider the following diagram:

      CC
    X CC
     <<<<

The difference with the previous diagram is that this time, the spike is
one tile closer. This time, there is no escape in 2.2 and you will
always die no matter what.

By the way, both diagrams have the same behavior if the conveyor is
rightwards and if everything is flipped upside-down. Thankfully, it
doesn't seem to be direction-dependent.

The reason 2.3 lowered the player onto the surface was for consistency
(see PR #502), and I don't want to undo that. So I think the best
solution here is to re-add the extra frame of control by conveyors only
moving the player after lifeseq has advanced enough.
2024-07-31 22:17:50 -07:00