1
0

Fix BG/SPPAGE

This commit is contained in:
otya128
2016-12-10 22:31:36 +09:00
parent 78a81529c9
commit 8faa3242b2
3 changed files with 15 additions and 10 deletions

View File

@@ -1428,11 +1428,11 @@ class BuiltinFunction
{
throw new OutOfRange("SPPAGE", 1);
}
p.sprite.sppage = page;
p.sprite.sppage[p.displaynum] = page;
}
static int SPPAGE(PetitComputer p)
{
return p.sprite.sppage;
return p.sprite.sppage[p.displaynum];
}
static void SPCLIP(PetitComputer p)
{
@@ -1668,11 +1668,11 @@ class BuiltinFunction
{
throw new OutOfRange("BGPAGE", 1);
}
p.bgpage = page;
p.bgpage[p.displaynum] = page;
}
static int BGPAGE(PetitComputer p)
{
return p.bgpage;
return p.bgpage[p.displaynum];
}
static void BGSHOW(PetitComputer p, int layer)
{

View File

@@ -208,7 +208,7 @@ class PetitComputer
this.y = y;
}
}
int bgpage;
int[2] bgpage;
Projects project;
wstring currentProject;
void init()
@@ -506,8 +506,8 @@ class PetitComputer
DerelictSDL2.load();
DerelictSDL2Image.load();
graphic.initGraphicPages();
sprite.sppage = 4;
bgpage = 5;
sprite.sppage[] = 4;
bgpage[] = 5;
SDL_Init(SDL_INIT_VIDEO);
DerelictGL.load();
@@ -650,11 +650,11 @@ class PetitComputer
}
version(test) glLoadIdentity();
version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z);
glBindTexture(GL_TEXTURE_2D, graphic.GRP[bgpage].glTexture);
if (BGvisibles[0])
{
chRenderingDisplay(0);
glBindTexture(GL_TEXTURE_2D, graphic.GRP[bgpage[0]].glTexture);
for(int i = 0; i < bgmax; i++)
{
bg[i].render(0, currentDisplay.rect[0].w, currentDisplay.rect[0].h);
@@ -663,6 +663,7 @@ class PetitComputer
if(currentDisplay.rect.length > 1 && BGvisibles[1])
{
chRenderingDisplay(1);
glBindTexture(GL_TEXTURE_2D, graphic.GRP[bgpage[0]].glTexture);
for(int i = bgmax; i < bg.length; i++)
{
bg[i].render(1, currentDisplay.rect[1].w, currentDisplay.rect[1].h);

View File

@@ -584,7 +584,7 @@ class Sprite
SpriteBucket[] buckets;
SpriteBucket* listptr;
SpriteBucket* bucketsptr;
int sppage;
int[2] sppage;
void render()
{
if ((!visibles[0] && !visibles[1]) || (petitcom.xscreenmode == 2 && !visibles[0]))
@@ -672,7 +672,7 @@ class Sprite
dish2 = 480f;
dis = -1;
}
auto texture = petitcom.graphic.GRP[sppage].glTexture;
auto texture = petitcom.graphic.GRP[sppage[0]].glTexture;
float aspect = disw2 / dish2;
float z = -0.01f;
int spmax = petitcom.xscreenmode == 1 ? this.spmax : 512;//XSCREENが2,3じゃないと下画面は描画しない
@@ -702,6 +702,8 @@ class Sprite
disw2 = petitcom.currentDisplay.rect[1].w;
petitcom.chRenderingDisplay(1, clipRect[1].x, clipRect[1].y, clipRect[1].w, clipRect[1].h);
aspect = disw2 / dish2;
texture = petitcom.graphic.GRP[sppage[1]].glTexture;
glBindTexture(GL_TEXTURE_2D, texture);
}
else
{
@@ -714,6 +716,8 @@ class Sprite
disw2 = petitcom.currentDisplay.rect[0].w;
petitcom.chRenderingDisplay(0, clipRect[0].x, clipRect[0].y, clipRect[0].w, clipRect[0].h);
aspect = disw2 / dish2;
texture = petitcom.graphic.GRP[sppage[0]].glTexture;
glBindTexture(GL_TEXTURE_2D, texture);
}
}
if (!visibles[dis])