foxygit / fake-08-xbox360 Log in
commit ca6d40642d98caf8f3b810c1fea7963c370fbb89
Author:     Jon Bell <jondbell@protonmail.com>
AuthorDate: Fri Apr 24 11:42:46 2020 -0600
Commit:     Jon Bell <jondbell@protonmail.com>
CommitDate: Fri Apr 24 11:42:46 2020 -0600

    implment mset and mget for shared spritesheet rows
---
 source/graphics.cpp | 13 +++++++------
 testcart.p8         | 13 ++++++++++---
 2 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/source/graphics.cpp b/source/graphics.cpp
index 2466418..235c1cc 100644
--- a/source/graphics.cpp
+++ b/source/graphics.cpp
@@ -553,21 +553,22 @@ void Graphics::clip(short x, short y, short w, short h) {
 //map methods heavily based on tac08 implementation
 uint8_t Graphics::mget(short celx, short cely){
 	if (cely < 32) {
-
 		return this->mapData[cely * 128 + celx];
 	}
-
-	//todo: get this from the sprite sheet?
+	else if (cely < 64){
+		return this->spriteSheetData[cely* 128 + celx];
+	}
+
 	return 0;
 }

 void Graphics::mset(short celx, short cely, uint8_t snum){
 	if (cely < 32) {
-
 		this->mapData[cely * 128 + celx] = snum;
 	}
-
-	//todo: set on second half of sprite sheet
+	else if (cely < 64){
+		this->spriteSheetData[cely* 128 + celx] = snum;
+	}
 }

 void Graphics::map(int celx, int cely, int sx, int sy, int celw, int celh) {
diff --git a/testcart.p8 b/testcart.p8
index 18aa485..d6de0d1 100644
--- a/testcart.p8
+++ b/testcart.p8
@@ -28,7 +28,13 @@ function _draw()
  cls()

  rectfill(0, 0, 127, 127, 0)
- map(0, 0, 0, 0, 3, 5)
+ map(0, 0, 0, 0, 3, 3)
+ mset(2, 3, 3)
+ mset(2, 4, 3)
+ mset(2, 5, 3)
+ map(0, 3, 0, 24, 3, 3)
+ --map call from shared sprite sheet section
+ map(126, 62, 0, 48, 2, 2)
  pset(1, 80, 10)
  pset(1.99, 80, 10)

@@ -241,15 +247,16 @@ f0000000000000000000000007700770000770000000000000000000000660005000000500000000
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005060
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003001
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005161
+00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000130
 __gff__
 0001020304050607080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000088ff
 __map__
 0102040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000506
 1112040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001516
+0404040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 0506040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 1516040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 0404040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000