From 2f7a8fedf126f48f2fa0bb2a3038e883bb462f04 Mon Sep 17 00:00:00 2001 From: otya128 Date: Sun, 4 Dec 2016 20:07:55 +0900 Subject: [PATCH] Fix sprite visibility --- SMILEBASIC/petitcomputer.d | 14 +++++++------- SMILEBASIC/sprite.d | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/SMILEBASIC/petitcomputer.d b/SMILEBASIC/petitcomputer.d index f835ccf..4e9ddb2 100644 --- a/SMILEBASIC/petitcomputer.d +++ b/SMILEBASIC/petitcomputer.d @@ -611,18 +611,18 @@ class PetitComputer bg[i].render(400f, 240f); } } - if(xscreenmode == 1) + if(xscreenmode == 1 && BGvisibles[1]) { - if (BGvisibles[1]) + chScreen(40, 0, 320, 240); + for(int i = bgmax; i < bg.length; i++) { - chScreen(40, 0, 320, 240); - for(int i = bgmax; i < bg.length; i++) - { - bg[i].render(320f, 240f); - } + bg[i].render(320f, 240f); } chScreen(0, 240, 400, 240); } + //glColor3f(1.0, 1.0, 1.0); + glMatrixMode(GL_MODELVIEW); + //glLoadIdentity(); } version(test) glLoadIdentity(); version(test) glRotatef(rot_test_deg, rot_test_x, rot_test_y, rot_test_z); diff --git a/SMILEBASIC/sprite.d b/SMILEBASIC/sprite.d index 8f6b9b7..5186734 100644 --- a/SMILEBASIC/sprite.d +++ b/SMILEBASIC/sprite.d @@ -668,28 +668,30 @@ class Sprite { if(!dis && sprite.id >= spmax) { + dis = true; if (!visibles[1]) continue; disw = 160f; disw2 = 320f; petitcom.chScreen(40, 0, 320, 240); aspect = disw2 / dish2; - dis = true; } else { if(sprite.id < spmax && dis) { + dis = false; if (!visibles[0]) continue; disw = 200f; disw2 = 400f; petitcom.chScreen(0, 240, 400, 240); aspect = disw2 / dish2; - dis = false; } } } + if (!visibles[dis]) + continue; int x, y; if(sprite.parent) {