Author Topic: Sprite Helpers  (Read 41001 times)

0 Members and 2 Guests are viewing this topic.

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #60 on: June 09, 2010, 10:24:06 pm »
Ah, I see what you did. Yeah, that looks to be much more efficient. Then again, it is pretty hard to fix code when you didn't write the thing and its over 5k.

If you're trying to figure out how it work, the best thing to do is look at the 14k source file on a computer, using something like SourceCoder. But good job figuring out how the whole thing works! Maybe you can tell me?
« Last Edit: June 09, 2010, 10:24:25 pm by Runer112 »

Offline Magic Banana

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 371
  • Rating: +77/-1
  • It's not an apple, it's a ... magic banana.
    • View Profile
Re: Sprite Helpers
« Reply #61 on: June 09, 2010, 10:36:34 pm »
Well, first I just scrolled down to where Full was, removed that, then I just kept jumping labels (and also just random scrolling and a bit of luck) until I found what you stored the number checking for grayscale to (G). Then looked for anything that changed it and did trial and error from there. It actually took less time than I though because the labels kinda help to see what I'm looking at. I think a check to call sub(DG) was where I found it, which I assumed is draw grayscale.
I do sprites and stuff, so yeah.

Quote from: yunhua98
i'M NOT SURE WHAT A SWORD SKILL IS BUT HERE'S THE SWORD ANIMATION FROM THE TWO SPRITES ON PG 13

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #62 on: June 09, 2010, 11:12:59 pm »
If you look at the commented version it would probably make a lot more sense. Also, you would know that "DG" stands for DispGraph. Any time the screen needs to be updated while sprite editing, I call this, which will perform either DispGraph, DispGraphʳ, or DispGraphʳʳ according to the sprite's grayscale level.

** Anyone who wants to, feel free to look at the source code and suggest optimizations. A good place to start may be areas that are easier to understand without knowing the intricate structures of the specific program, namely routines that perform math/graphics operations. Rotate and flip could be good candidates for this... It's really hard for me to add features with the current features already maxing out the program's size! **
« Last Edit: June 09, 2010, 11:33:02 pm by Runer112 »

Offline Magic Banana

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 371
  • Rating: +77/-1
  • It's not an apple, it's a ... magic banana.
    • View Profile
Re: Sprite Helpers
« Reply #63 on: June 09, 2010, 11:34:57 pm »
This is what I was refering to:
:If Gsub(N0)
:sub(DG)
:End

Eh, I was close enough.

Oh wow . Just opened up the commented version in SourceCoder. The amount of detail in these comments is ridiculous!
I'll take a pass or two through it and see if any revisions can be made. Although, I don't quite have everything down for optimizing in Axe so I probably won't find much.
I do sprites and stuff, so yeah.

Quote from: yunhua98
i'M NOT SURE WHAT A SWORD SKILL IS BUT HERE'S THE SWORD ANIMATION FROM THE TWO SPRITES ON PG 13

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #64 on: June 09, 2010, 11:40:43 pm »
One thing I'm doing is removing as much code I had previously planned on using, but never ended up finishing/getting to fit in the program. One such example is sprite moving/copying/pasting, which I just found a subroutine for that I forgot to comment out. Saved maybe 30 bytes, and at this size, every byte counts.

EDIT: Just chopped off about 150 more bytes. Realized that my sprite changing keypress handling was the complex version I needed back when I was trying to develop sprite copying/moving, so simplified that quite a bit.
« Last Edit: June 09, 2010, 11:56:39 pm by Runer112 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Sprite Helpers
« Reply #65 on: June 09, 2010, 11:59:47 pm »
I only read page 2 of this thread so far but what I saw is totally EPIC! I'm glad to see such sprite editor for Axe. It looks great too.

I will add it to the downloads section when finished. (Unless Axe includes it)
« Last Edit: June 10, 2010, 12:07:27 am by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Magic Banana

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 371
  • Rating: +77/-1
  • It's not an apple, it's a ... magic banana.
    • View Profile
Re: Sprite Helpers
« Reply #66 on: June 10, 2010, 12:41:35 am »
Hey that is really cool!  Definitely will consider adding this to the Axe Tools, with your permission of course.

You might just want to put it in the downloads as well, in case somebody wants to use it, but doesn't use Axe or wants to download the entire zip just for it.

@runer112: Some optimizations that would be very helpful would be to require less free ram to use. I've had the thing throw an ERR:memory when I had around 8-9k free ram (after archiving it). Maybe Quigibo can give some tips on doing that.
I do sprites and stuff, so yeah.

Quote from: yunhua98
i'M NOT SURE WHAT A SWORD SKILL IS BUT HERE'S THE SWORD ANIMATION FROM THE TWO SPRITES ON PG 13

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: Sprite Helpers
« Reply #67 on: June 10, 2010, 03:34:11 am »
You can start a new thread if you want.  It doesn't have to be in the Axe subforum either.

By the way, I looked at the code and there are a lot of optimizations possible.  I'll mention a few:

You should NEVER find yourself having to make big lists of non-data.  I noticed this in the Help routine.  I know its doted out, but if you want to do it efficiently, try this:

Code: [Select]
:.HELP
:If K=53
:  Fix 0
:  -1→A
:  Repeat sub(15)
:    sub(DT)
:    sub(GK)
:    If Ksub(1)→T and (A+1<number_you_will_need_to_determine)
:      While {A+1→A+Str00}:End
:    End
:    If K=4 and (A≠-1)
:      While {A-1→A+Str00}:End
:    End
:  End
:  sub(L)
:End


:.Draw Text
:Lbl DT
:  A→B
:  ClrDraw
:  For(J,0,9)
:    While {B+1→B+Str00}
:      Text(0,J*6+3,{B+Str00}►Frac)
:    End
:  End
:  DispGraph
:Return

You can then get rid of all those extra text subroutines.  I don't know if this routine works its untested, but you can probably see how it works.  Also, add a det(1) before Str00.

Code: [Select]
:      3→K
:      3-Xsub(M4)→W

Can be:

:      3→K-Xsub(M4)→W

Code: [Select]
:      0→D
:      2→K

Can be:

:      0→D+2→K


I'll add more stuff later.
« Last Edit: June 10, 2010, 03:36:29 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #68 on: June 10, 2010, 11:43:21 am »
I'd love to add back a help system, but with only about 200 bytes of available space left in the program, there's no way I could add one. At least until you figure out a way to let us call outside programs. ;D
« Last Edit: June 10, 2010, 11:58:52 am by Runer112 »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sprite Helpers
« Reply #69 on: June 10, 2010, 11:58:37 am »
If you're trying to avoid the 8811 byte limit, remember that that's only for executable code.  If you wanted, you could have 8811 bytes of executable code and 12000 bytes of data on the end of it.  Since your help text would be data, I think you could fit it in 200 bytes of executable code. ;D
Good luck. :)

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #70 on: June 10, 2010, 11:59:44 am »
If you're trying to avoid the 8811 byte limit, remember that that's only for executable code.  If you wanted, you could have 8811 bytes of executable code and 12000 bytes of data on the end of it.  Since your help text would be data, I think you could fit it in 200 bytes of executable code. ;D
Good luck. :)

Wait, it's 8811? I thought it was 8192? Please say it is, that means I have 600 more bytes of free space than I thought I had!

EDIT: I just compiled and tried to run a 8,420-byte (no shell) program and it throws ERR:INVALID.

EDIT 2: However, when I run the program compiled for Ion, it successfully runs.
« Last Edit: June 10, 2010, 12:06:26 pm by Runer112 »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sprite Helpers
« Reply #71 on: June 10, 2010, 12:02:57 pm »
Quoted from Asm in 28 days:
"Assembly programs for the TI-83 Plus cannot be more than 8811 bytes in size. Well they can, but just keep them below that. "
Yay, almost 666 more bytes! :D

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #72 on: June 10, 2010, 12:09:18 pm »
I just compiled and tried to run a 8,420-byte (no shell) program and it throws ERR:INVALID. However, when I run the program compiled for Ion, it successfully runs... I guess I could just make the program Ion-compatible only, I doubt many people even use no shell assembly programs.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Sprite Helpers
« Reply #73 on: June 10, 2010, 12:11:58 pm »
I just compiled and tried to run a 8,420-byte (no shell) program and it throws ERR:INVALID. However, when I run the program compiled for Ion, it successfully runs... I guess I could just make the program Ion-compatible only, I doubt many people even use no shell assembly programs.
That's odd.  Does it throw the error on smaller programs too?  Besides that's not what would happen if you hit the executable code limit; the calc would maybe turn off and then RAM Clear. :)
Oh, and I like no stub Asm programs. ;D

Offline Runer112

  • Project Author
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2289
  • Rating: +639/-31
    • View Profile
Re: Sprite Helpers
« Reply #74 on: June 10, 2010, 12:15:26 pm »
I think I've successfully run an 8197-byte no shell program before, but much more than that and I get ERR:INVALID.