Author Topic: Why doesn't my Map Drawer Work?  (Read 6129 times)

0 Members and 2 Guests are viewing this topic.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Why doesn't my Map Drawer Work?
« on: June 10, 2010, 03:19:22 pm »
Code: [Select]
.TILEMAP
.SPRITES
[003C424242423C00]->Pic10
[00003C3C3C3C0000]->Pic20
.First Is top sprite, second bottom.
.MAP TEST
[00000000]->GDB1
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
[00000000]
LBL DP
ClrDraw
ClrDrawr
For(y,0,7)
For(X,0,7)
Pt-On(X*8,Y*8,Y*8+X+GDB1*16+Pic10)
Pt-On(X*8,Y*8,Y*8+X+GDB1*16+Pic20)r
Repeat getKey(15)
DispGraphrr
End

This, instead of drawing some nice sprites in an 8x8 grid, Draws Speckly garbage all over the grid. I think it's a problem with my GDB or Pic referencing, but I can't figure out how to fix it. Any help?

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #1 on: June 10, 2010, 03:25:05 pm »
in "Y*8+X+GDB1*16+Pic10" are you sure those are the correct order of operations? i'm not completely sure i haven't tested this on my calc yet (programming it in now) but shouldn't it be Y*8+X+GDB1+Pic10? i'll edit this post later.


Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #2 on: June 10, 2010, 03:27:31 pm »
You're reading from an 8x16 grid.  Don't forget, each hex digit is half a byte.  You need them in pairs unless you're doing half-byte compression.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Why doesn't my Map Drawer Work?
« Reply #3 on: June 10, 2010, 03:28:48 pm »
Yeah, there shouldn't be the *16 to the GDB1. Why'd you put that there, just curious? Also, you're map is 4 bytes wide, so it would be Y*4, not 8...
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #4 on: June 10, 2010, 03:59:44 pm »
Well, the order of operations were correct, but I forgot the 2-digit byte rule (again)

the x16 was to get the Pic10 and Pic20 to the correct sprite. So, sprite 0 would be at +0, 1 would be +16 and 3 would be at +48

I changed the map to be 8 by 8 now...I also added {} to GDB1. That's the way to take the value at that location, right? That may have been one of the major issues.

Well, this time it shows the sprite I made at the top corner of the screen, but the rest is still a jumbled mess.

Offline cooliojazz

  • Support Staff
  • LV7 Elite (Next: 700)
  • *******
  • Posts: 619
  • Rating: +66/-9
  • I omnoms on your soul
    • View Profile
    • Unreal Phantasies
Re: Why doesn't my Map Drawer Work?
« Reply #5 on: June 10, 2010, 04:01:58 pm »
They would be at the correct place without *16... and no, you don't want {} because that argument is a memory location, the routine grabs the value itself.
EDIT: Hold on, never mind, i think your right, except it would be *8, since thats how big the tiles are right? the second part is still an issue tho =P
« Last Edit: June 10, 2010, 04:04:58 pm by cooliojazz »
Spoiler For Random signess:
You can not beat my skills.
Trust me.
So don't even try.
And remember never to trust someone who says, "Trust me."

TI File Editor Progress: Remade in java like a boss. 50% we'll call it? IDK =P
Java Libraries: JIRC - 90% JTIF - 5%
TI Projects: Unreal Notator - -5000%
Nomcraft, a Bukkit mod
Some of the music I write can be found here | The Rest Should Be Here (Bandcamp)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #6 on: June 10, 2010, 04:04:58 pm »
ok, thanks. I'll fix it again.
.
.
.
Well, It certainly did Something different. The scramblings are all now uniform, but I keep getting this weird stairs effect. Here' I'll get a screenshot if I can.

Edit: here's a screenie from my camera. I couldn't get the flash to shut off.

BTW the blue pixels are from the flash.

Edit2: Shrank the image. Sorry about that.
« Last Edit: June 10, 2010, 04:21:04 pm by willrandship »

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #7 on: June 10, 2010, 04:24:55 pm »
can u post the source code that made this happen? It still seems like random RAM garbage bytes


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #8 on: June 10, 2010, 04:29:19 pm »
You want

Code: [Select]
Pt-On(X*8,Y*8,{Y*8+X+GDB1}*8+Pic10)
:)

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: Why doesn't my Map Drawer Work?
« Reply #9 on: June 10, 2010, 05:07:21 pm »
Thanks! Now it works!

Now, to make the sprites for it....