1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-27 23:18:30 +02:00
Commit Graph

2757 Commits

Author SHA1 Message Date
Dav999
82240d262b Game::loadcustomlevelstats: move some declarations to later in function
The declarations of `std::vector<std::string> customlevelnames` and
`std::vector<int> customlevelscores` are made quite early in the
function, commented with "Old system", but the place where the old
system is processed is after a big chunk of code that processes the new
system (and indeed never uses these vectors). So for readability,
they're now closer to where they're used.
2023-11-19 16:18:54 -08:00
mothbeanie
58c006f61f decrease map cursor margin on smaller map sizes 2023-11-19 15:59:27 -08:00
mothbeanie
94ece095ed PR_BOR8 -> PR_FULLBOR, border8 -> full_border 2023-11-19 15:59:27 -08:00
mothbeanie
947d716be6 remove tile_offset (no longer used) 2023-11-19 15:59:27 -08:00
mothbeanie
3a3ec659d6 Add translingual map legend code + border8 2023-11-19 15:59:27 -08:00
mothbeanie
7840f72389 Add translingual map legend characters to font 2023-11-19 15:59:27 -08:00
AllyTally
103b4d36a1 Add textimage for levelcomplete and gamecomplete
`levelcomplete` and `gamecomplete` were hardcoded using textbox colors
which were offset by 1. This PR fixes that, no longer requiring
slightly-off colors, and instead adding a new property to textboxes
which tell the game to display either level complete or game complete.
2023-11-19 15:07:25 -08:00
AllyTally
b5c9508dd4 Finish implementing sprites in textboxes
This commit adjusts the Y position for flip-mode, and makes the main
game use this new system.
2023-11-19 15:07:25 -08:00
AllyTally
76ea4488af Initial implementation of textbox sprites
This commit adds a system for displaying sprites in textboxes, meant to
replace the hardcoded system in the main game. This does not support
levelcomplete.png and gamecomplete.png yet, which will most likely just
be special cases.
2023-11-19 15:07:25 -08:00
Dav999
187fd85e14 Change saved <summary> tag back to English
This ensures loading a 2.4 save in the English-only 2.3 or earlier
doesn't result in missing characters because a translated area name
appears in the save file. We are not reading from <summary> anymore
in 2.4.

The way this is done is by not translating the area names inside
mapclass::currentarea(), but at the callsites other than the one which
saves the <summary>.
2023-11-19 13:49:59 -08:00
Dav999
ac7fe4475c Remove more tele/quick variables duplicating info in struct Summary
For both `tele` and `quick`, I removed these attributes of class Game:
- std::string *_gametime
- int *_trinkets
- std::string *_currentarea
- bool *_crewstats[numcrew]

All this info can now be gotten from members of Game::last_telesave and
Game::last_telesave. I've also cleaned up the continue menu to not have
all the display code appear twice (once for telesave and once for
quicksave).

RIP "Error! Error!" though lol
2023-11-19 13:49:59 -08:00
Dav999
f23ffc0457 Get rid of Game::savearea (std::string)
This is what got saved to the area part of the <summary> tags, and it
was specifically set upon pressing ACTION to save in the map menu.
Which meant tsave.vvv may not get an accurate area name (notably
"nowhere" if you hadn't quicksaved before in that session) even though
it's not displayed anywhere so it didn't really matter. But this
variable can be removed - there's only one place where <summary> is
written for both quicksaves and telesaves, so that now gets the area
at saving time.

Fun fact: custom level quicksaves also have a <summary> tag, and it's
even less functional than the one in tsave.vvv, because it stores
whatever main-game area name applies to your current coordinates.
So I simply filled in the level's name instead (just like what the
actual save box says).
2023-11-19 13:49:59 -08:00
Dav999
0ea41e7913 Replace std::string Game::telesummary and Game::quicksummary by Summary
Game::telesummary and Game::quicksummary stored the summary string for
the save files - which is the <summary> tag that says something like
"Space Station, 10:30:59". The game only ever displays the quicksave
variant of these two, for "Last Save:" on the map menu's SAVE tab.
So the telesave has a <summary> too, but it's never displayed anywhere.
(In fact, the area is often set to "nowhere"...)

However, the summary strings have another function: detect that both
the telesave and quicksave exist. If a summary string for a save is
empty, then that save is considered not to exist.

I'm refactoring the summary string system, by making the new variables
Game::last_telesave and Game::last_quicksave of type struct
Game::Summary. This struct should have all data necessary to display
the summary string at runtime, and thus translate it at runtime (so
we don't store a summary in a certain language and then display it in
the wrong font later - the summary can always be in the current
language). It also has an `exists` member, to replace the need to
check for empty strings.

The <summary> tag is now completely unused, but is still written to
for older versions of the game to read.

(This commit does not add the new string to the language files, since
Terry now added it separately in his own branch)
2023-11-19 13:49:59 -08:00
Dav999
64bad7d67f Remove double NULL check in loadthissummary() 2023-11-19 13:49:59 -08:00
Dav999
61adffe6eb Remove finalmode from struct Summary
It's unused (other than some map.finalmode assignments which should not
be there) and we don't need it either. If we do, we can always readd
it.
2023-11-19 13:49:59 -08:00
Dav999
50a560dc5f Change savex and savey in struct Summary to saverx and savery
This is a bit misleading otherwise, since it is the room coordinates,
not pixel coordinates.
2023-11-19 13:49:59 -08:00
Dav999
4e5126a596 Move struct Summary from Game.cpp to Game.h
This will allow it to be used in other source files in a later commit.
2023-11-19 13:49:59 -08:00
Dav999
89a165722e Simplify mapclass::currentarea()
It used to take a single int: the area number returned by
mapclass::area(roomx, roomy). All uses of currentarea() were called
with an extra area() call as its argument. Additionally, there's a
good reason why currentarea() should have the room coordinates: in one
of the cases that it's called, there's a special case for the ship's
coordinates. This results in the SAVE screen in the map menu being able
to show "The Ship", while the continue screen shows "Dimension VVVVVV"
instead. Therefore, why not put that exception inside currentarea()
instead, and remove a few callsite map.area() wrappers by making
currentarea() take the room x and y coordinates?
2023-11-19 13:49:59 -08:00
Dav999
73911a7ada Remove game.customquicksummary
It's completely unused (apart from the variable being set in one
place). So let's get this out of the way.
2023-11-19 13:49:59 -08:00
Misa
0a72cc6614 Android: Update README.md for Maven package
Since #1047 was merged, we now make the user build the SDL prefab
themselves (as SDL does not publish Maven packages yet). Here are some
instructions for doing that.
2023-11-14 17:29:34 -08:00
leo60228
ca71410f14 Use Android SDL2 via Maven 2023-11-14 17:18:08 -08:00
Dav999
1d3173f5c1 Fix %cs showing instead of commit date on Windows (or older git?)
Whenever I'd compile on Windows, I'd see the literal text "%cs" in the
main menu instead of the commit date. I never thought much of it (at
least it runs, and the date only shows up in development builds). Now
that I've also seen a screenshot from Terry with it, I decided to look
into it further. Looks like it's a format string that our gits on
Windows aren't recognizing for whatever reason - probably because
they're too old. I have git version 2.23.0.windows.1, and checking its
help page for `git log`, under PRETTY FORMATS, %cs is missing as an
option, while some other options are still there. So the option was
probably added sometime between that version and 2.34.1, which is the
one I have on Linux, where %cs does work.

Luckily, %cd with --date=short seems equivalent, and better supported,
so we can just use that instead.
2023-11-13 14:42:48 -08:00
Misa
1e5a737089 CMake: Silence deprecation warning
Recent versions of CMake emit the following:

    CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
      Compatibility with CMake < 3.5 will be removed from a future version of
      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.

Reading the documentation further, adding a max refers to the max
version compatibility of CMake _policies_. Adding a max of 3.5 makes the
warning go away, so it seems that the warning is more about policies
than anything else.

This will still work on 2.8.12 as the extra dots will be seen as a
version component separator, ignoring the max version.
2023-10-31 22:36:11 -07:00
Dav999
b3810b686d Update README-translators.txt with info about sprites translation 2023-10-31 22:31:41 -07:00
Dav999
5c7be6c1de Add Dutch translated sprites
These should be pretty finalized, and serve as a demo for this PR.
2023-10-31 22:31:41 -07:00
Dav999
9045e26d3e Add support for translatable sprites
Language folders can now have a graphics folder, with these files:
- sprites.png and flipsprites.png: spritesheets which contain
  translated versions of the word enemies and checkpoints
- spritesmask.xml: an XML file containing all the sprites that should
  be copied from the translated sprites and flipsprites images to
  the original sprites/flipsprites.

This means that the translated spritesheets don't have to contain ALL
sprites - they only have to contain the translated ones. When loading
them, the game assembles a combined spritesheet with translated sprites
replacing English ones as needed, and this sheet is used to visually
substitute the normal sprites at rendering time.

It's important to note that even if 32x32 enemies have pixel-perfect
hitboxes, this is only a visual change. This has been discussed several
times on Discord - basically we don't want to give people unfair
advantages or disadvantages because of their language setting, or
change existing gameplay and speedruns tactics, which may depend on the
exact pixel arrangements of the enemies. Therefore, the hitboxes are
still based on the English sprites. This should be basically
unnoticeable for casual players, especially with some thought from
translators and artists, but there will be an option in the speedrunner
menu to display the original sprites all the time.

I removed the `VVV_freefunc(SDL_FreeSurface, *tilesheet)` in
make_array() in Graphics.cpp, which frees grphx.im_sprites_surf and
grphx.im_flipsprites_surf. Since GraphicsResources::destroy() already
frees these, it looks like the only purpose the one in make_array()
serves is to do it earlier. But now we need them again later (when
switching languages) so let's just not free them early.
2023-10-31 22:31:41 -07:00
Dav999
8ef000554d Add "English sprites" setting
It'll start working in the next commit... See the description there.

(This commit does not add the new strings to the language files, since
Terry now added them separately in his own branch)
2023-10-31 22:31:41 -07:00
Dav999
92f9940464 Update my GitHub username and Ved repo link
I recently changed my GitHub username from Dav999-v to Daaaav, and
today I moved the Ved repo from GitGud.io to GitHub. This commit
updates the references to both my username and the Ved repository.
2023-10-28 19:04:44 -07:00
Misa
ea1a014145 Fix memory leak with ApplyFilter
The intention of the recent refactor was to make it so that the
temporary surfaces would be allocated only once, when the mode is
enabled, and be freed upon exit.

To do this, Graphics.cpp owns the pointers, and passes them to
ApplyFilter to modify. Except ApplyFilter doesn't actually modify the
pointers, because it's only a single pointer, not a pointer-to-pointer.
So every frame of rendering it would actually be creating a new surface
and leaking memory.

To fix this, they need to be pointer-to-pointer variables that get
modified.

I also added error logs in case the surface creation failed.
2023-10-27 10:25:42 -07:00
Misa
791310fa5d Provide error code if SetConsoleOutputCP fails
According to the Win32 documentation, GetLastError provides extended
error information if SetConsoleOutputCP fails.
2023-10-25 17:21:11 -07:00
Dav999
98d1a38d7f Allow UTF-8 console output on Windows (for -console)
Right now, Windows assumes all our console output is code page ????.
That means our UTF-8 output appears mangled. (I ran into this while
testing IME text input by outputting strings to the console)

For a moment I was scared we'd need to do UTF-16 conversions and call
Windows-specific print functions like WriteConsoleW() in our vlog
functions, but fortunately SetConsoleOutputCP(CP_UTF8) works just fine.
2023-10-25 17:17:49 -07:00
Dav999
36dbb0f73a Show centiseconds for best time trial times (if available)
Since VVVVVV 2.3, time trial best times are stored not just with the
number of seconds, but also the number of frames. However, there was
no room to display it with the old design of the time trials screen.
Now there is, so it can easily be displayed now with a small change!

Unset frames are stored as -1, which fits perfectly into the frames
argument of help.format_time(), because in that case the amount of
centiseconds is not shown.

It should be noted that opening VVVVVV 2.2 will instantly wipe your
frames records, as described by #1030. But many people will likely
never open 2.2 anymore.
2023-10-25 17:06:50 -07:00
Misa
a46c817c69 Clarify references to Make and Play in README
Some people might be confused by the reference to M&P in the
instructions referring to downloading data.zip (#1026).

data.zip is the same between M&P and full versions of the game and is
orthogonal to which version of the game is built. Building M&P just
requires uncommenting `#define MAKEANDPLAY` in `MakeAndPlay.h`.

So clarify that you can grab data.zip from your existing copy of the
game, or from the Make and Play _page_ (not necessarily the Make and
Play edition of the game), and add instructions for building the M&P
version.

Closes #1027.
2023-10-25 16:47:25 -07:00
Misa
9a9fb5b237 Android: README: Fix swapped h1/h2 headers
The ones I meant to be h1 appeared as h2 and vice versa. Whoops.
2023-10-25 16:44:23 -07:00
Misa
75a693347b vlog: Slim SDL.h include down to SDL_log.h
The entirety of SDL doesn't need to be included, only the SDL_log header
does.
2023-10-25 15:48:04 -07:00
Misa
f83b63142d Android: Add README.md
This serves as a file to help others in building the C++ Android version
for themselves.

These instructions are what I figured out to get it to work for me, and
should be kept up to date.
2023-10-25 15:04:12 -07:00
leo60228
d6a43fad90 Fix compiler warnings on Android 2023-10-25 14:44:34 -07:00
leo60228
246a91c45e Use existing package name to allow updates 2023-10-25 14:44:34 -07:00
leo60228
e170d19e16 make more tasks depend on zipRepoAssets 2023-10-25 14:44:34 -07:00
leo60228
c84bc14122 Android CI 2023-10-25 14:44:34 -07:00
leo60228
6d88f8b1d6 Ignore output-metadata.json 2023-10-25 14:44:34 -07:00
leo60228
dae5f7bbd7 Use adaptive icon (legacy was chosen by mistake) 2023-10-25 14:44:34 -07:00
leo60228
4512c13507 Fix release builds (Gradle why) 2023-10-25 14:44:34 -07:00
leo60228
2986dc01d9 Add DocumentsProvider 2023-10-25 14:44:34 -07:00
leo60228
9d1d994f57 Disable editor on Android (like Steam Deck) 2023-10-25 14:44:34 -07:00
leo60228
945823ca30 Build and mount repo.zip with fonts/ and lang/ 2023-10-25 14:44:34 -07:00
leo60228
3e0cf57a99 Address review 2023-10-25 14:44:34 -07:00
leo60228
f3f9d1b523 Enable ABI splits
This is somewhat convenient for development, as it means that Android
Studio will only do a native build for the architecture of the device
being used for testing.

This is ignored for AABs, so it won't affect release builds (at least
for Google Play).
2023-10-25 14:44:34 -07:00
leo60228
4229372c2e Android port 2023-10-25 14:44:34 -07:00
Terry Cavanagh
6e18cddc69
Merge pull request #1035 from TerryCavanagh/mobile-version-update
Add missing files that the mobile version needs to compile
2023-10-16 09:53:13 +01:00