Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: kindermoumoute on January 21, 2011, 07:36:04 pm

Title: A present at any price
Post by: kindermoumoute on January 21, 2011, 07:36:04 pm
Original post is in french : here (http://www.siteduzero.com/concours-657-12615-un-cadeau-a-tout-prix.html)
I'm working on a mini RPG in axe, on christmas theme.
Here a screenie :
(http://img828.imageshack.us/img828/3143/testuncadeautoutprix.gif)

You can download source and ex : here (http://www.siteduzero.com/uploads/fr/concours/12001_13000/12615.zip)
Title: Re: A present at any price
Post by: Happybobjr on January 21, 2011, 07:37:06 pm
poor snowmen :(


Looks good. (and evil >D)
Title: Re: A present at any price
Post by: Xeda112358 on January 21, 2011, 07:39:35 pm
Oh, that is really cool! Nice! This is one of those inspirations for me to learn french...
Title: Re: A present at any price
Post by: kindermoumoute on January 21, 2011, 07:42:47 pm
Thank.
I just forget to notice, screen show without full speed mode, but when you press "+" key, full speed mode is enable (same key to disable).
Title: Re: A present at any price
Post by: Munchor on January 21, 2011, 07:47:27 pm
It looks pretty cool kinder! Why did you kill the snowman, though? XD

now I'm serious, this is some great coding, the laser, the moving engine, the killing, great job!
Title: Re: A present at any price
Post by: kindermoumoute on January 22, 2011, 05:21:36 am
I got some random bug, and I don't know where come from. Here my code :

Code: [Select]
:.Z1KDOA2P
:identity(00002008583E3C1C3C1444006C0044003800440082008FCA8A00440038000000)
:
:.Buffer santa
:[182466423C427C54→GDB000
:[1E25564438C47C28
:[78A46A221C233E14
:[1824255B43423C24]
:
:.back-buffer santa
:[183C66423C7E7C54]→GDB001
:[1E27564438FC7C28
:[78E46A221C3E3E14]
:[183C3D7E7E7E3C24]
:
:.buffer tile
:[0000000000000000→Pic1
:[10286C4482FE387C]
:[182499663C42423C]
:[0000000000000000]
:[0008181012FE387C]
:
:.back-buffer tile
:[0000000000000000→Pic2
:[1038547CFEFE487C]
:[0000000000000000]
:[44AA7CFEAAAAAAFE]
:[0810000280000000]
:
:.snow
:[0000000000000000→Pic000
:[005A186666185A00]
:
:.Burn
:[0038441222241800]→Pic999
:[00007C7E7E7C3800]
:
:
:[111111111111]→GDB1
:[100100111001]
:[101100001001]
:[101000000211]
:[100000000001]
:[110000220011]
:[111100001111]
:
:[111110011111]
:
:[111100001111]
:[100100020001]
:[100100020001]
:[100112220101]
:[100000000001]
:[100000000001]
:
:[111111111101]
:
:[100000000001]
:[100222222001]
:[100200002001]
:[100203202001]
:[100222202001]
:[100000000001]
:
:[111111111111]
:
:[100100100001]
:[101001000001]
:[101000100001]
:[100000000001]
:[100000000001]
:[100000000001]
:
:[111111111111]
:
:[100100000001]
:[100100000001]
:[100010000001]
:[100001000001]
:[100020000001]
:[100000000001]
:
:[111111111111]
:
:
:1→{L<sub>2</sub>}+1→{L<sub>2</sub>+1}→{L<sub>2</sub>+2}
:3→{L<sub>2</sub>+3}-2→{L<sub>2</sub>+4}→{L<sub>2</sub>+5}
:4→{L<sub>2</sub>+6}-1→{L<sub>2</sub>+7}→{L<sub>2</sub>+8}
:0→{L<sub>1</sub>}→{L<sub>1</sub>+1}→N→V→F→I→P→D→E
:1→M→A→B
:
:...
:List 1 is use to snow
:List 2 is coordonate, and level of burn
:D slow the IA move
:E is a temporary variable is test IA (IAT)
:N is level
:V permit to add wind
:F = 1 if full speed mode is enable, else 0
:I slow display of snow
:P direction of santa
:M maximum of snow
:A and B are coordinated of santa
:X and Y are tempory variable, use in tilemapping loop, and laser direction
:Z and Θ are use in shoot routine, animation of present, and snow
:variables from r1 to r4 are use to manipulate Data
:variable r5 and r6 ar use in shoot routine
:...
:
:.Main loop
:Repeat getKey(15)
:sub(PTO
:sub(IA)
:sub(ACT)
:sub(D)
:sub(GKY)
:End
:Return
:
:.Display screen
:Lbl D
:Pt-On(A*8,B*8,P*8+GDB000
:Pt-On(A*8,B*8,P*8+GDB001)<sup>r</sup>
:If F
:Normal
:End
:If getKey(10)
:1-F→F
:sub(NOG)
:End
:DispGraph<sup>r</sup>
:If F
:Full
:End
:Return
:
:.Laser and interaction main routine
:Lbl ACT
:!If P
:If sub(DAT,A,B+1)→r<sub>4</sub> and getKey(48)
:sub(CR8,0,1)
:ElseIf getKey(54)
:sub(SHT,0,1)
:End
:ElseIf P=1
:If sub(DAT,A-1,B)→r<sub>4</sub> and getKey(48)
:sub(CR8,‾1,0)
:ElseIf getKey(54)
:sub(SHT,‾1,0)
:End
:ElseIf P=2
:If sub(DAT,A+1,B)→r<sub>4</sub> and getKey(48)
:sub(CR8,1,0)
:ElseIf getKey(54)
:sub(SHT,1,0)
:End
:ElseIf P=3
:If sub(DAT,A,B-1)→r<sub>4</sub> and getKey(48)
:sub(CR8,0,‾1)
:ElseIf getKey(54)
:sub(SHT,0,‾1)
:End
:End
:Return
:
:.Laser routine
:Lbl SHT
:r<sub>1</sub>→r<sub>5</sub>
:r<sub>2</sub>→r<sub>6</sub>
:A→Z*8→X
:B→Θ*8→Y
:!If P
:B+1*8→Y
:A*8+1→X
:ElseIf P=3
:A*8+7→X
:B*8+1→Y
:Else
:B*8+5→Y
:If P=2
:A+1*8→X
:End
:End
:Repeat sub(DAT,Z+r<sub>5</sub>→Z,Θ+r<sub>6</sub>→Θ)→r<sub>4</sub> or sub(IAT)
:Line(X,Y,X-(A-Z*8),Y-(B-Θ*8))
:sub(D
:End
:If r<sub>4</sub>=1
:sub(CPR,4)
:ElseIf r<sub>4</sub>=2
:sub(CPR,0)
:ElseIf r<sub>4</sub>=3
:.coffre
:End
:Return
:
:.Compression Data
:Lbl CPR
:If r<sub>3</sub>^2
:{r<sub>3</sub>/2+GDB1}-r<sub>4</sub>+r<sub>1</sub>→{r<sub>3</sub>/2+GDB1}
:Else
:r<sub>1</sub>-r<sub>4</sub>*16+{r<sub>3</sub>/2+GDB1}→{r<sub>3</sub>/2+GDB1}
:End
:Return
:
:.Interaction with tile
:Lbl CR8
:Fix 5
:ref(0,7,95,9)
:rref(0,7,95,9)
:ref(0,7,95,9)<sup>r</sup>
:rref(0,7,95,9)<sup>r</sup>
:Text(0,8)
:If r<sub>4</sub>=1
:DrawF "I\\\'m just a tree !
:ElseIf r<sub>4</sub>=2
:DrawF "Nothing in this snowman.
:ElseIf r<sub>4</sub>=3
:sub(CPR,0)
:0→{r<sub>3</sub>/2+18+GDB1}
:DrawF "Woa, the present allowed !
:0→Z
:For(Θ,0,9)
:If 1-Z→Z
:Horizontal +
:Else
:Horizontal -
:End
:sub(D
:Pause 100
:End
:End
:sub(NOG)
:Repeat getKey(0)
:sub(D
:End
:Fix 4
:Return
:
:Lbl GKY
:
:.Move santa
:If getKey(2)
:If P≠1
:1→P
:ElseIf (sub(DAT,A-1,B)=0
:A-1→A
:End
:End
:If getKey(3)
:If P≠2
:2→P
:ElseIf (sub(DAT,A+1,B)=0
:A+1→A
:End
:End
:If getKey(4)
:If P≠3
:3→P
:ElseIf (sub(DAT,A,B-1)=0
:B-1→B
:End
:End
:If getKey(1)
:If P
:0→P
:ElseIf (sub(DAT,A,B+1)=0
:B+1→B
:End
:End
:
:.Change level
:If B=7
:N+1→N
:1→B
:Else!If B
:N-1→N
:6→B
:End
:If {L<sub>2</sub>+3}=9 and (N=3)
:sub(DAT,10,7)
:sub(CPR,0)
:End
:Return
:
:.Test if laser touch burn
:Lbl IAT
:For(E,0,2)
:If {E*3+1+L<sub>2</sub>}=Z and ({E*3+2+L<sub>2</sub>}=Θ) and ({E*3+L<sub>2</sub>}=N)
:9→{E*3+L<sub>2</sub>}
:1
:Return
:End
:End
:0
:Return
:
:.Intelligence artificial (burn move)
:Lbl IA
:For(Z,0,2)
:If {Z*3+L<sub>2</sub>}=N
:If 1-D→D
:{Z*3+1+L<sub>2</sub>→r<sub>6</sub>}<A and (sub(DAT,{r<sub>6</sub>}+1,{r<sub>6</sub>+1})=0)-({r<sub>6</sub>}>A and (sub(DAT,{r<sub>6</sub>}-1,{r<sub>6</sub>+1})=0))+{r<sub>6</sub>}→{r<sub>6</sub>}
:End
:Pt-On({r<sub>6</sub>}*8,{r<sub>6</sub>+1}*8,Pic999)
:Pt-On({r<sub>6</sub>}*8,{r<sub>6</sub>+1}*8,Pic999+8)<sup>r</sup>
:If {r<sub>6</sub>}=A and ({r<sub>6</sub>+1}=B)
:Disp "GAME OVER
:Disp "PRESS ENTER
:Repeat getKey(9)
:End
:0→N
:1→A→B
:ElseIf sub(DAT,{r<sub>6</sub>},{r<sub>6</sub>+1})=1
:sub(CPR,4)
:ElseIf sub(DAT,{r<sub>6</sub>},{r<sub>6</sub>+1})
:sub(CPR,0)
:End
:If D
:{r<sub>6</sub>+1}<B and (sub(DAT,{r<sub>6</sub>},{r<sub>6</sub>+1}+1)=0)-({r<sub>6</sub>+1}>B and (sub(DAT,{r<sub>6</sub>},{r<sub>6</sub>+1}-1)=0))+{r<sub>6</sub>+1}→{r<sub>6</sub>+1}
:End
:End
:End
:Return
:
:.No key pressed
:Lbl NOG
:While getKey(0)
:sub(D
:End
:Return
:
:.Extract Data
:Lbl DAT
:N*84+(r<sub>2</sub>*12)+r<sub>1</sub>→r<sub>3</sub>
:{r<sub>3</sub>/2+GDB1}→r<sub>4</sub>
:If r<sub>3</sub>^2
:r<sub>4</sub>^16
:Else
:r<sub>4</sub>/16
:End
:Return
:
:Lbl PTO
:
:.Classique tilemapping
:ClrDraw
:ClrDraw<sup>r</sup>
:For(Y,0,7)
:For(X,0,11)
:sub(DAT,X,Y)*8→S
:Pt-On(X*8,Y*8,S+Pic1)
:Pt-On(X*8,Y*8,S+Pic2)<sup>r</sup>
:End
:End
:
:.Display snow
:For(Θ,0,M)
:Pt-On(sub(L1,0),sub(L1,1),Pic000
:Pt-On(sub(L1,0),sub(L1,1),Pic000+8)<sup>r</sup>
:If sub(L1,1)=61 or (sub(L1,0)>87)
:rand^88→{Θ*2+L<sub>1</sub>)
:0→{Θ*2+L<sub>1</sub>+1}
:Else
:sub(L1,1)+1→{Θ*2+L<sub>1</sub>+1}
:sub(L1,0)+V→{Θ*2+L<sub>1</sub>}
:End
:End
:If 1-I→I
:If M<20
:M+1→M
:rand^88→{M*2+L<sub>1</sub>}
:End
:End
:Return
:
:Lbl L1
:{Θ*2+L<sub>1</sub>+r<sub>1</sub>}

Screen can display white, like if I corrupt memory  (and corrupt program) :
Title: Re: A present at any price
Post by: ztrumpet on January 22, 2011, 11:41:34 am
Looks great, Kinder! :D
Title: Re: A present at any price
Post by: yunhua98 on January 22, 2011, 06:04:21 pm
Hmm...  I'm having trouble with your compression...  also, are those sprites the ones I did a long time ago?

btw, the snow looks kinda odd...
Title: Re: A present at any price
Post by: DJ Omnimaga on January 25, 2011, 01:28:40 am
Lol nice, I like the idea, it's pretty original. :D

By the way for those who can't read french the story is:

"After his annual gift distributing run, Santa Claus discovers a mysterious gift package remaining at the end of his hut. This gift must be delivered in a far-away country, populated by fireballs. He then decides that this gift must be delivered at any cost and thus he goes on a crazy quest, armed with his laser gun."
Title: Re: A present at any price
Post by: kindermoumoute on January 26, 2011, 10:08:53 am
Thank DJ to translate. ;)

@yunhua98 : Have you a compression routine less dangerous, because mine need extract byte before compress.
Title: Re: A present at any price
Post by: yunhua98 on January 26, 2011, 01:06:11 pm
no, I just can't understand it that well.  XD
Title: Re: A present at any price
Post by: kindermoumoute on January 26, 2011, 02:55:41 pm
Look understandable source :
Code: [Select]
:Data(55,45)=>Str1
:Disp {Str1}>Dec
:.Display 55
:Disp {Str1+1}>Dec
:.Display 45
:
:12=>{Str1}>Dec
:Disp Str1
:.Display 12
:16=>{Str1+1}
:Disp {Str1+1}>Dec
:.Display 16
Title: Re: A present at any price
Post by: Ashbad on January 26, 2011, 03:27:50 pm
This is actually looking really cool!  Keep up the great work, this will probablhy be the first christmas RPG for calcs :D