Omnimaga

Calculator Community => HP Calculators => HP Prime => Topic started by: DJ Omnimaga on January 12, 2014, 04:09:56 pm

Title: HP Prime nitacku-ized (animation)
Post by: DJ Omnimaga on January 12, 2014, 04:09:56 pm
Some people might remember that Nitacku used some xLIB glitches and shortcuts to pull off incredible fade-in/out animations in his hybrid Basic games.

(http://img338.imageshack.us/img338/2854/screenshotxa8.gif)

Well, on the HP Prime it was pretty easy to replicate one of them :D

(http://img.ourl.ca/nitackuanim.gif)

It could be handy for an RPG battle transition. :D

Code: [Select]
EXPORT nitackuanim()
BEGIN
DIMGROB_P(G1,320,240);
BLIT_P(G1,G0);
FOR Z FROM 239 DOWNTO 0 DO
BLIT_P(G0,0,Z,320,240,G1,0,Z,320,Z);
WAIT(.125);
END;
END;
Title: Re: HP Prime nitacku-ized (animation)
Post by: JWinslow23 on January 13, 2014, 11:48:22 am
I made one in Axe!

Code: [Select]
.A
0 -> X
For(95)
0 -> Y
For(63)
If rand^2
Pxl-Change(X,Y
End
Y++
End
X++
End
63 -> A
While A
Rect(0,A,95,64-A
0 -> X
For(95)
!If pxl-Test(X,A-1
RectI(X,A,1,64-A
End
X++
End
DispGraph
A--
End

Easier than I thought.
Title: Re: Re: HP Prime nitacku-ized (animation)
Post by: DJ Omnimaga on January 13, 2014, 11:52:23 am
Now that you post this, I wish that I added some similar animation at the end of Supersonic Ball 83+ title screen. I should maybe update the game with one eventually, as well as a scrolling title background like on the HP Prime.
Title: Re: HP Prime nitacku-ized (animation)
Post by: JWinslow23 on January 13, 2014, 11:54:19 am
Nice to see you like it.

Oh, and everything before "63 -> A" Is unnecessary, just to give a background to fade in and out.
Title: Re: HP Prime nitacku-ized (animation)
Post by: Eiyeron on January 13, 2014, 02:53:22 pm
YOu should speed up the effect for the game DJ, it seems too long to be not annoying after ~15 times.
Title: Re: HP Prime nitacku-ized (animation)
Post by: TIfanx1999 on January 13, 2014, 03:40:09 pm
The speed can be changed if someone else wanted to use this in their game, just adjust the wait command. :) I think the current speed is pretty good though personally.
Title: Re: HP Prime nitacku-ized (animation)
Post by: Matrefeytontias on January 13, 2014, 03:57:46 pm
Quick try, non-tested (admits that you want to apply the effect to the current content of the screen) :
Code: [Select]
62->A+1
While 1
Copy(-1*12+L6,+12,63-A*12)
DispGraph
End!If A--+1
Title: Re: HP Prime nitacku-ized (animation)
Post by: JWinslow23 on January 13, 2014, 04:08:54 pm
Show-off. <_<

It's a little too fast.

EDIT: And it doesn't loop through the *whole* screen
Title: Re: HP Prime nitacku-ized (animation)
Post by: Hayleia on January 13, 2014, 04:10:17 pm
Quick try, non-tested (admits that you want to apply the effect to the current content of the screen) :
Code: [Select]
62->A+1
While 1
Copy(-1*12+L6,+12,63-A*12)
DispGraph
End!If A--+1
Works.
Title: Re: HP Prime nitacku-ized (animation)
Post by: Matrefeytontias on January 13, 2014, 04:16:59 pm
Show-off. <_<

It's a little too fast.

EDIT: And it doesn't loop through the *whole* screen
My goal was to make it as fast as possible :P you can put a Pause right after the DispGraph.

According to Hayleia's screenshot, it does do what it's intended to do.
Title: Re: HP Prime nitacku-ized (animation)
Post by: Hayleia on January 13, 2014, 04:38:14 pm
My goal was to make it as fast as possible :P you can put a Pause right after the DispGraph.
I don't see the point of making it fast, an animation has to be seen.
So I made a version that saves 8 bytes :P
Code: [Select]
0->r1
L6+768-24
For(63)
 Copy(,+12,r1+12->r1)-r1-12
 Select(,DispGraph)
End
Title: Re: HP Prime nitacku-ized (animation)
Post by: Matrefeytontias on January 13, 2014, 05:03:54 pm
I saved 5 bytes to your code ;D
Code: [Select]
L6+768-24
For(63)
->r1
Copy(,+12,-(L6+768)*~1)
DispGraph
r1-12
End
Now we are going off-topic though, if someone could move that part to the Axe subforum ...

EDIT : I can save another 4 bytes by replacing ->r1 with Asm(E5) and r1-12 with Asm(E1)-12. Funny to notice that if you apply the ASM trick, you have a code that actually does something cool while not using any variable ;D  - HL abuse is nearing molestation though
Title: Re: HP Prime nitacku-ized (animation)
Post by: Hayleia on January 13, 2014, 05:30:57 pm
Well you can get rid of r1 by doing this
Code: [Select]
L6+768-24
For(63)
 Select(,sub(Sub))-12
End
Return
Lbl Sub
Copy(,+12,-(L6+768)*~1)
DispGraph
Return
which is exactly the same as pushing hl and popping it back as you proposed, but with a necessary procedure (because Axe doesn't like Copy inside of a Select) that makes the code save no byte (you lose the 4 bytes you earned with the call and the ret). But yeah, it doesn't use any variable now.
Title: Re: HP Prime nitacku-ized (animation)
Post by: Matrefeytontias on January 13, 2014, 06:19:45 pm
Yeah I found that too, but since it was slower and no smaller, I just did not post it.
Title: Re: HP Prime nitacku-ized (animation)
Post by: DJ Omnimaga on January 13, 2014, 08:32:04 pm
YOu should speed up the effect for the game DJ, it seems too long to be not annoying after ~15 times.
Yeah I made it at the slowest speed to show how capable it was. I personally would make it three times faster at least. However, this means I might lose the game three times more often <_<

Also yeah I agree about Copy/Conj for the Axe program. I didn't read the code much earlier but then noticed the lack of those commands. Supersonic Ball parallax scrolling uses multiple Copy commands to speed backgrounds up considerably.

What I am curious is if something like this is feasible in xLIBC...
Title: Re: HP Prime nitacku-ized (animation)
Post by: Hayleia on January 14, 2014, 02:33:10 am
Yeah I found that too, but since it was slower and no smaller, I just did not post it.
Well it is not bigger, and you'll probably put a Pause in it anyway, so there is no problem :P
And the fact it doesn't use any variable is still interesting because that means you can call it anywhere without losing anything (except your buffer but that's what you wanted if you called it).

Also, I can save one byte by changing the 63 into a 62 and removing a Return so it does save space (and I beat you in optimization :P)
Code: [Select]
L6+768-24
For(62)
Select(,sub(Sub))
-12
End
Lbl Sub
Copy(,+12,-(L6+768)*~1)
DispGraph
Return