Move from surfaces to the SDL render system

Ever since VVVVVV was initially ported to C++ in 2.0, it has used surfaces from SDL. The downside is, that's all software rendering. This commit moves most things off of surfaces, and all into GPU, by using textures and SDL_Renderer.

Pixel-perfect collision has been kept by keeping a copy of sprites as surfaces. There's plans for pixel-perfect collision to use masks instead of reading pixel data directly, but that's out of scope for this commit.

- `graphics.reloadresources()` is now called later in `main`, because textures cannot be created without a renderer.

- This commit also removes a bunch of surface functions which are no longer needed.

- This also recaches target textures in certain places for d3d9.

- graphics.images was converted to a fixed-size array.

- fillbox and fillboxabs use SDL_RenderDrawRect instead of drawing an outline using four filled rectangles

- Update my name in the credits
This commit is contained in:
AllyTally
2023-01-07 14:28:07 -04:00
committed by Misa Elizabeth Kai
parent 556e3a110a
commit 19b2a317f1
24 changed files with 1446 additions and 1387 deletions

View File

@@ -175,41 +175,54 @@ void scriptclass::run(void)
#if !defined(NO_CUSTOM_LEVELS)
if (words[0] == "warpdir")
{
int temprx=ss_toi(words[1])-1;
int tempry=ss_toi(words[2])-1;
int temprx = ss_toi(words[1]) - 1;
int tempry = ss_toi(words[2]) - 1;
const RoomProperty* room;
cl.setroomwarpdir(temprx, tempry, ss_toi(words[3]));
room = cl.getroomprop(temprx, tempry);
//Do we update our own room?
if(game.roomx-100==temprx && game.roomy-100==tempry){
if (game.roomx - 100 == temprx && game.roomy - 100 == tempry)
{
//If screen warping, then override all that:
graphics.backgrounddrawn = false;
map.warpx=false; map.warpy=false;
if(room->warpdir==0){
map.warpx = false;
map.warpy = false;
if (room->warpdir == 0)
{
map.background = 1;
//Be careful, we could be in a Lab or Warp Zone room...
if(room->tileset==2){
if (room->tileset == 2)
{
//Lab
map.background = 2;
graphics.rcol = room->tilecol;
}else if(room->tileset==3){
}
else if (room->tileset == 3)
{
//Warp Zone
map.background = 6;
}
}else if(room->warpdir==1){
map.warpx=true;
map.background=3;
graphics.rcol = cl.getwarpbackground(temprx,tempry);
}else if(room->warpdir==2){
map.warpy=true;
map.background=4;
graphics.rcol = cl.getwarpbackground(temprx,tempry);
}else if(room->warpdir==3){
map.warpx=true; map.warpy=true;
}
else if (room->warpdir == 1)
{
map.warpx = true;
map.background = 3;
graphics.rcol = cl.getwarpbackground(temprx, tempry);
}
else if (room->warpdir == 2)
{
map.warpy = true;
map.background = 4;
graphics.rcol = cl.getwarpbackground(temprx, tempry);
}
else if (room->warpdir == 3)
{
map.warpx = true;
map.warpy = true;
map.background = 5;
graphics.rcol = cl.getwarpbackground(temprx,tempry);
graphics.rcol = cl.getwarpbackground(temprx, tempry);
}
}
}