1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00
Commit Graph

12 Commits

Author SHA1 Message Date
Misa
b5ff65c84e Remove unnecessary includes from header files
Including a header file inside another header file means a bunch of
files are going to be unnecessarily recompiled whenever that inner
header file is changed. So I minimized the amount of header files
included in a header file, and only included the ones that were
necessary (system includes don't count, I'm only talking about includes
from within this project). Then the includes are only in the .cpp files
themselves.

This also minimizes problems such as a NO_CUSTOM_LEVELS build failing
because some file depended on an include that got included in editor.h,
which is another benefit of removing unnecessary includes from header
files.
2020-07-19 21:37:40 -04:00
Misa
6c85fae339 Change all tilemaps to be short[1200] instead of int[1200]
This removes around megabyte from the binary, so a stripped -Og binary
went from 4.0 megabytes to 2.9 megabytes, and an unstripped -O0 binary
went from 8.1 megabytes to 7.1 megabytes, which means I can now finally
upload an unstripped -O0 binary to Discord without having to give money
to Discord for their dumb Nitro thing or whatever.
2020-07-19 16:25:53 -04:00
Misa
63f6784cfe Remove unused <vector> include from Otherlevel.h
I forgot to do this earlier in my previous pull request de-vectoring
everything.
2020-07-08 19:14:21 -04:00
Misa
420bc38dff Move Roomtext struct to Map.h
This is a more appropriate place for it, because it's never used in
Otherlevel.cpp.
2020-07-08 19:14:21 -04:00
Misa
5e8ca20d02 Remove block type enum from Otherlevel.h
I have no idea why this is here. It should already be included from
Entity.h, anyway. There's no reason to copy-paste it.
2020-07-08 19:14:21 -04:00
Misa
ec960b0f95 Remove roomtext from otherlevelclass
Since it's unused, it's better to just delete it because there's no way
to test it to see if it's buggy or not.
2020-07-08 19:14:21 -04:00
Misa
9dcda17978 Turn map.contents into a plain array
map.contents always has 1200 tiles in it, there's no reason it should be
a vector.

This is a big commit because it requires changing all the level classes
to return a pointer to an array instead of returning a vector. Which
took a while for me to figure out, but eventually I did it. I tested to
make sure and there's no problems.
2020-07-06 11:19:24 -04:00
Misa
b53d2ae53f Remove i/j/k attributes from classes that don't need them
The only class that actually needs its i/j/k kept is scriptclass,
because some custom levels rely on it for creating custom activity
zones. So I haven't touched that.

Other than that, there's no chance that anything important relies on
i/j/k in any other class. For that to be the case, it would have to use
i/j/k without initializing it beforehand, and that can simply be
detected by removing the attribute from the header file and seeing where
the compiler complains. And the compiler complains only about cases
where it's initialized first. (Note that due to this check, I *haven't*
removed Graphics's `m` as it precisely does exactly this, using it
without initializing it first.)

Interestingly enough, otherlevelclass and towerclass have unused i/k
variables for whatever reason.
2020-06-14 14:37:29 -04:00
Misa
ec72031cfd Refactor Otherlevel.cpp to not use strings for tilemaps
Instead, they're all held in a constant int array instead.
2020-05-17 22:03:29 -04:00
Misa
d910800423 Remove global args from main game loadlevel() functions
This removes global args from Finalclass.cpp, Labclass.cpp,
Otherlevel.cpp, Spacestation2.cpp, and WarpClass.cpp.
2020-04-03 10:40:50 -04:00
Misa
a4d7fc017c Refactor roomtext to not use ad-hoc objects / separate length trackers
This refactors the roomtext code to (1) not use ad-hoc objects and (2)
not use a separate length-tracking variable to keep track of the actual
amount of roomtext in a room.

What I mean by ad-hoc object is, instead of formally creating a
fully-fledged struct or class and storing one vector containing that
object, this game instead hacks together an object by storing each
attribute of an object in different vectors.

In the case of roomtext, instead of making a Roomtext object that has
attributes 'x', 'y', and 'text', the 'text' attribute of each is stored
in the vector 'roomtext', the 'x' attribute of each is stored in the
vector 'roomtextx', and the 'y' attribute of each is stored in the
vector 'roomtexty'. It's only an object in the sense that you can grab
the attributes of each roomtext by using the same index across all three
vectors.

This makes it somewhat annoying to maintain and deal with, like when I
wanted add sub-tile positions to roomtext in VVVVVV: Community Edition.
Instead of being able to add attributes to an already-existing
formalized Roomtext object, I would instead have to add two more
vectors, which is inelegant. Or I could refactor the whole system, which
is what I decided to do instead.

Furthermore, this removes the separate length-tracking variable
'roomtextnumlines', which makes the code much more easy to maintain and
deal with, as the amount of roomtext is naturally tracked by C++ instead
of us having to keep track of the actual amount of roomtext manually.
2020-02-29 23:02:52 -05:00
Ethan Lee
f7c0321b71 Hello WWWWWWorld! 2020-01-08 10:37:50 -05:00