Compare commits

...

4 Commits

Author SHA1 Message Date
leo60228 89886e6c52
Run CI on CentOS 7 (#574) 2021-01-11 00:30:15 -05:00
Misa b1558f574c Remove game.savemystats
This variable seems to have been intended to make sure
game.savestatsandsettings() was called at the end of the frame, or make
sure that it didn't get called more than once per frame. I don't see any
frame ordering-related reason why it needs to be called specifically at
the end of the frame (the function doesn't modify any state), so it's
more plausible that it was added to make sure it didn't get called more
than one per frame.

However, upon further analysis, none of the code paths where
game.savemystats is used ever calls or sets game.savemystats more than
once, and a majority of the code directly calls
game.savestatsandsettings() anyway, so there's no reason for this
variable to exist. If we ever need to make sure it doesn't get called
more than once, and there's no way to change the code paths around to
prevent it otherwise, we can use the defer callbacks system that I added
to #535, when it gets merged.
2021-01-11 00:26:14 -05:00
Misa 17d06f06be Remove map.finalx/y and map.customx/y
These variables basically serve no purpose. map.customx and map.customy
are clearly never used. map.finalx and map.finaly, on the other hand,
are basically always game.roomx and game.roomy respectively if
map.finalmode is on, and if it's off, then they don't matter.

Also, there are some weird and redundant variable assignments going on
with these; most notably in map.gotoroom(), where rx/ry (local
variables) get assigned to finalx/finaly, then finalx/finaly get
assigned to game.roomx/game.roomy, then finalx/finaly get assigned to
rx/ry. If finalx/finaly made a difference, then there'd be no need to
assign finalx/finaly back to rx/ry. So it makes the code clearer to
remove these weird bits of code.
2021-01-11 00:24:59 -05:00
Misa b571fa0919 Add F9 "reload resources" hotkey to list of hotkeys in Shift menu
2.3's per-level assets feature also added a hotkey to reload the custom
assets of the level you're currently editing in the editor, so you
wouldn't have to re-load the level yourself. This hotkey is F9, but
however, it hasn't been documented in the hotkey list brought up by
pressing Shift, until now.
2021-01-11 00:21:50 -05:00
11 changed files with 117 additions and 115 deletions

View File

@ -7,30 +7,19 @@ env:
SRC_DIR_PATH: desktop_version
jobs:
build:
name: Build
build-mac:
name: Build (macos-latest)
runs-on: ${{ matrix.os }}
runs-on: macos-latest
env:
CXXFLAGS: -I/usr/local/include/SDL2
LDFLAGS: -L/usr/local/lib
strategy:
matrix:
os: [ubuntu-18.04, macos-latest]
steps:
- uses: actions/checkout@v1
- name: Install dependencies (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y ninja-build libsdl2-dev libsdl2-mixer-dev
- name: Install dependencies (macOS)
if: startsWith(matrix.os, 'macos')
- name: Install dependencies
run: brew install ninja sdl2 sdl2_mixer
- name: CMake configure (default version)
@ -69,6 +58,55 @@ jobs:
- name: Build (no editor)
run: ninja -C ${SRC_DIR_PATH}/build
build-lin:
name: Build (CentOS 7)
runs-on: ubuntu-latest
container: ghcr.io/leo60228/vvvvvv-build@sha256:485448ad437653d47ceb068a0f2b910f4eb336107d340a1f0d828ca95c987985
env:
CXXFLAGS: -I/usr/local/include/SDL2
LDFLAGS: -L/usr/local/lib
steps:
- uses: actions/checkout@v1
- name: CMake configure (default version)
run: |
mkdir ${SRC_DIR_PATH}/build && cd ${SRC_DIR_PATH}/build
cmake ..
- name: Build (default version)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (official)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DOFFICIAL_BUILD=ON ..
- name: Build (official)
run: |
make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (M&P)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DOFFICIAL_BUILD=OFF -DMAKEANDPLAY=ON ..
- name: Build (M&P)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (no custom levels)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DMAKEANDPLAY=OFF -DCUSTOM_LEVEL_SUPPORT=DISABLED ..
- name: Build (no custom levels)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
- name: CMake configure (no editor)
run: |
cd ${SRC_DIR_PATH}/build
cmake -DCUSTOM_LEVEL_SUPPORT=NO_EDITOR ..
- name: Build (no editor)
run: make -j $(nproc) -C ${SRC_DIR_PATH}/build
build-win:
name: Build (windows-latest)

View File

@ -0,0 +1,2 @@
**
!Dockerfile

View File

@ -0,0 +1,41 @@
FROM centos:7
# run first to improve caching (other things update more often than SDL2)
WORKDIR /tmp
RUN curl -O https://www.libsdl.org/release/SDL2-2.0.14.tar.gz
RUN tar -xf SDL2-2.0.14.tar.gz
RUN mkdir SDL2-2.0.14/build
RUN curl -O https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.4.tar.gz
RUN tar -xf SDL2_mixer-2.0.4.tar.gz
RUN mkdir SDL2_mixer-2.0.4/build
# add EPEL (for SDL2)
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# install dependencies
RUN yum -y install \
# used below
yum-utils \
# SDL2_mixer dependencies
libogg-devel libvorbis-devel \
# VVVVVV dependencies
gcc-c++ cmake make
RUN yum-builddep -y SDL2
RUN yum clean all
WORKDIR /tmp/SDL2-2.0.14/build
RUN ../configure
RUN make -j $(nproc)
RUN make install
WORKDIR /tmp/SDL2_mixer-2.0.4/build
RUN ../configure
RUN make -j $(nproc)
RUN make install
WORKDIR /tmp
RUN rm -rf SDL2-2.0.14.tar.gz SDL2-2.0.14/ SDL2_mixer-2.0.4.tar.gz SDL2_mixer-2.0.4/
WORKDIR /

View File

@ -130,7 +130,6 @@ void Game::init(void)
roomchange = false;
savemystats = false;
quickrestartkludge = false;
tapleft = 0;
@ -3229,8 +3228,6 @@ void Game::updatestate()
map.final_mapcol = 0;
map.final_colorframe = 0;
map.finalstretch = false;
map.finalx = 100;
map.finaly = 100;
graphics.cutscenebarspos = 320;
graphics.oldcutscenebarspos = 320;
@ -5289,15 +5286,7 @@ void Game::readmaingamesave(tinyxml2::XMLDocument& doc)
map.finalstretch = help.Int(pText);
}
if (pKey == "finalx")
{
map.finalx = help.Int(pText);
}
else if (pKey == "finaly")
{
map.finaly = help.Int(pText);
}
else if (pKey == "savex")
if (pKey == "savex")
{
savex = help.Int(pText);
}
@ -5492,15 +5481,7 @@ void Game::customloadquick(std::string savfile)
}
if (pKey == "finalx")
{
map.finalx = help.Int(pText);
}
else if (pKey == "finaly")
{
map.finaly = help.Int(pText);
}
else if (pKey == "savex")
if (pKey == "savex")
{
savex = help.Int(pText);
}
@ -5885,10 +5866,6 @@ std::string Game::writemaingamesave(tinyxml2::XMLDocument& doc)
//Position
xml::update_tag(msgs, "finalx", map.finalx);
xml::update_tag(msgs, "finaly", map.finaly);
xml::update_tag(msgs, "savex", savex);
xml::update_tag(msgs, "savey", savey);
@ -6016,10 +5993,6 @@ bool Game::customsavequick(std::string savfile)
//Position
xml::update_tag(msgs, "finalx", map.finalx);
xml::update_tag(msgs, "finaly", map.finaly);
xml::update_tag(msgs, "savex", savex);
xml::update_tag(msgs, "savey", savey);
@ -6649,12 +6622,12 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
if (temp == 1)
{
createmenu(Menu::unlocktimetrial, true);
savemystats = true;
savestatsandsettings();
}
else if (temp > 1)
{
createmenu(Menu::unlocktimetrials, true);
savemystats = true;
savestatsandsettings();
}
}
else
@ -6673,7 +6646,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
unlocknotify[17] = true;
unlock[17] = true;
createmenu(Menu::unlocknodeathmode, true);
savemystats = true;
savestatsandsettings();
}
//Alright then! Flip mode?
else if (unlock[5] && !unlocknotify[18])
@ -6681,7 +6654,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
unlock[18] = true;
unlocknotify[18] = true;
createmenu(Menu::unlockflipmode, true);
savemystats = true;
savestatsandsettings();
}
//What about the intermission levels?
else if (unlock[7] && !unlocknotify[16])
@ -6689,7 +6662,7 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
unlock[16] = true;
unlocknotify[16] = true;
createmenu(Menu::unlockintermission, true);
savemystats = true;
savestatsandsettings();
}
else
{

View File

@ -374,8 +374,6 @@ public:
std::string hardestroom;
int hardestroomdeaths, currentroomdeaths;
bool savemystats;
bool quickrestartkludge;

View File

@ -687,7 +687,7 @@ static void menuactionpress()
{
// toggle Flip Mode
graphics.setflipmode = !graphics.setflipmode;
game.savemystats = true;
game.savestatsandsettings();
if (graphics.setflipmode)
{
music.playef(18);
@ -1307,7 +1307,7 @@ static void menuactionpress()
{
// WARNING: Partially duplicated in Menu::options
graphics.setflipmode = !graphics.setflipmode;
game.savemystats = true;
game.savestatsandsettings();
if (graphics.setflipmode)
{
music.playef(18);

View File

@ -29,8 +29,6 @@ mapclass::mapclass()
finalmode = false;
finalstretch = false;
finalx = 50;
finaly = 50;
cursorstate = 0;
cursordelay = 0;
@ -48,7 +46,6 @@ mapclass::mapclass()
custommode=false;
custommodeforreal=false;
customx=0; customy=0;
customwidth=20; customheight=20;
custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0;
customzoom=0;
@ -897,18 +894,13 @@ void mapclass::gotoroom(int rx, int ry)
if (finalmode)
{
//Ok, what way are we moving?
finalx = rx;
finaly = ry;
game.roomx = finalx;
game.roomy = finaly;
game.roomx = rx;
game.roomy = ry;
game.roomchange = true;
rx = finalx;
ry = finaly;
if (game.roomy < 10)
{
game.roomy = 11;
finaly = 11;
}
if(game.roomx>=41 && game.roomy>=48 && game.roomx<61 && game.roomy<68 )
@ -1377,7 +1369,7 @@ void mapclass::loadlevel(int rx, int ry)
}
case 6: //final level
{
const short* tmap = finallevel.loadlevel(finalx, finaly);
const short* tmap = finallevel.loadlevel(rx, ry);
SDL_memcpy(contents, tmap, sizeof(contents));
roomname = finallevel.roomname;
tileset = 1;
@ -1452,7 +1444,6 @@ void mapclass::loadlevel(int rx, int ry)
obj.entities[i].yp += (71 * 8);
}
game.roomy--;
finaly--;
ypos = (100-29) * 8;
oldypos = ypos;
@ -1497,7 +1488,6 @@ void mapclass::loadlevel(int rx, int ry)
obj.entities[i].yp += (71 * 8);
}
game.roomy--;
finaly--;
ypos = (100-29) * 8;
oldypos = ypos;

View File

@ -116,15 +116,12 @@ public:
int spikeleveltop, spikelevelbottom;
int oldspikeleveltop, oldspikelevelbottom;
//final level navigation
int finalx;
int finaly;
bool finalmode;
bool finalstretch;
//Variables for playing custom levels
bool custommode;
bool custommodeforreal;
int customx, customy;
int customwidth, customheight;
int custommmxoff, custommmyoff, custommmxsize, custommmysize;
int customzoom;

View File

@ -1584,11 +1584,7 @@ void scriptclass::run()
else if (words[0] == "finalmode")
{
map.finalmode = true;
map.finalx = ss_toi(words[1]);
map.finaly = ss_toi(words[2]);
game.roomx = map.finalx;
game.roomy = map.finaly;
map.gotoroom(game.roomx, game.roomy);
map.gotoroom(ss_toi(words[1]), ss_toi(words[2]));
}
else if (words[0] == "rescued")
{
@ -2056,8 +2052,6 @@ void scriptclass::run()
else if (words[0] == "startintermission2")
{
map.finalmode = true; //Enable final level mode
map.finalx = 46;
map.finaly = 54; //Current
game.savex = 228;
game.savey = 129;
@ -2891,8 +2885,6 @@ void scriptclass::startgamemode( int t )
music.fadeout();
map.finalmode = true; //Enable final level mode
map.finalx = 46;
map.finaly = 54; //Current
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3017,8 +3009,6 @@ void scriptclass::startgamemode( int t )
game.supercrewmate = true;
game.scmprogress = 0;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3053,8 +3043,6 @@ void scriptclass::startgamemode( int t )
game.supercrewmate = true;
game.scmprogress = 0;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3089,8 +3077,6 @@ void scriptclass::startgamemode( int t )
game.supercrewmate = true;
game.scmprogress = 0;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3125,8 +3111,6 @@ void scriptclass::startgamemode( int t )
game.supercrewmate = true;
game.scmprogress = 0;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3158,8 +3142,6 @@ void scriptclass::startgamemode( int t )
game.crewstats[game.lastsaved] = true;
game.inintermission = true;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3191,8 +3173,6 @@ void scriptclass::startgamemode( int t )
game.crewstats[game.lastsaved] = true;
game.inintermission = true;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3224,8 +3204,6 @@ void scriptclass::startgamemode( int t )
game.crewstats[game.lastsaved] = true;
game.inintermission = true;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3257,8 +3235,6 @@ void scriptclass::startgamemode( int t )
game.crewstats[game.lastsaved] = true;
game.inintermission = true;
map.finalmode = true;
map.finalx = 41;
map.finaly = 56;
map.final_colormode = false;
map.final_mapcol = 0;
map.final_colorframe = 0;
@ -3321,8 +3297,6 @@ void scriptclass::startgamemode( int t )
ed.ghosts.clear();
map.custommode = true;
map.customx = 100;
map.customy = 100;
//set flipmode
if (graphics.setflipmode) graphics.flipmode = true;
@ -3359,8 +3333,6 @@ void scriptclass::startgamemode( int t )
map.custommodeforreal = true;
map.custommode = true;
map.customx = 100;
map.customy = 100;
//set flipmode
if (graphics.setflipmode) graphics.flipmode = true;
@ -3399,8 +3371,6 @@ void scriptclass::startgamemode( int t )
hardreset();
map.custommodeforreal = true;
map.custommode = true;
map.customx = 100;
map.customy = 100;
game.customstart();
game.customloadquick(ed.ListOfMetaData[game.playcustomlevel].filename);
@ -3690,8 +3660,6 @@ void scriptclass::hardreset()
map.showtrinkets = false;
map.finalmode = false;
map.finalstretch = false;
map.finalx = 50;
map.finaly = 50;
map.final_colormode = false;
map.final_colorframe = 0;
map.final_colorframedelay = 0;

View File

@ -3463,14 +3463,15 @@ void editorrender()
if(ed.shiftmenu)
{
fillboxabs(0, 127,161+8,140,graphics.getRGB(64,64,64));
FillRect(graphics.backBuffer, 0,128,160+8,140, graphics.getRGB(0,0,0));
graphics.Print(4, 130, "F1: Change Tileset",164,164,164,false);
graphics.Print(4, 140, "F2: Change Colour",164,164,164,false);
graphics.Print(4, 150, "F3: Change Enemies",164,164,164,false);
graphics.Print(4, 160, "F4: Enemy Bounds",164,164,164,false);
graphics.Print(4, 170, "F5: Platform Bounds",164,164,164,false);
fillboxabs(0, 117,171+8,140,graphics.getRGB(64,64,64));
FillRect(graphics.backBuffer, 0,118,170+8,140, graphics.getRGB(0,0,0));
graphics.Print(4, 120, "F1: Change Tileset",164,164,164,false);
graphics.Print(4, 130, "F2: Change Colour",164,164,164,false);
graphics.Print(4, 140, "F3: Change Enemies",164,164,164,false);
graphics.Print(4, 150, "F4: Enemy Bounds",164,164,164,false);
graphics.Print(4, 160, "F5: Platform Bounds",164,164,164,false);
graphics.Print(4, 180, "F9: Reload Resources",164,164,164,false);
graphics.Print(4, 190, "F10: Direct Mode",164,164,164,false);
graphics.Print(4, 210, "W: Change Warp Dir",164,164,164,false);

View File

@ -639,12 +639,6 @@ static void inline fixedloop()
//We did editorinput, now it's safe to turn this off
key.linealreadyemptykludge = false;
if (game.savemystats)
{
game.savemystats = false;
game.savestatsandsettings();
}
//Mute button
if (key.isDown(KEYBOARD_m) && game.mutebutton<=0 && !key.textentry())
{