;------------------ put them together --- it's too big for one file
Text 10,410, "look in tutorial for more help" Color 255,255,255 st$ = "Close Help with F1 or Help in menu again" ln=StringWidth (st$) Text gw2-(ln/2),gh2+200, st$ Color 180,180,180 ElseIf waittext = 1 ShowEntity darky SetFont bigfont st$ = "Wait a moment, I am busy" ln = StringWidth(st$) Text gw2-(ln/2),gh2, st$ SetFont font ElseIf checkend = 1 SetFont font ShowEntity darky st$ = "Really Quit ? y/n (for yes: y,z,j / for no: all other keys)" ln = StringWidth(st$) UpdateWorld RenderWorld Text gw2-(ln/2),gh2, st$ Flip WaitKey If KeyDown(KEY_Z) Or KeyDown(Key_Y) Or KeyDown(Key_J) Then Goto aus1 DownWait(KEY_Z) DownWait(KEY_Y) DownWait(KEY_J) DownWait(1) checkend = 0 FlushKeys Flip Else HideEntity Darky Text 10,30, "Name of the Bone: "+aktbonename$ Color 255,255,0 Text gw-150,30, "EDIT-Mode" Color 180,180,180 Text gw-150,50, "weight = " + weight# ; IF BoObMode = 0 ; Color 0,255,0 ; Text gw-200,50, "Object-Mode" If differentVertexMode > 0 Color 0,255,255 ln=StringWidth ("Diff-Vertex mode") Text (gw2-(ln/2)),50, "Diff-Vertex mode" Color 180,180,180 ln=StringWidth ("select vertex with LMB, toggle through list with L") Text (gw2-(ln/2)),70, "select vertex with LMB, toggle through list with L" EndIf ; Color 180,180,180 ; Text gw-200,70, "weight# = "+weight# ; ELSEIF BoObMode = 1 ; Color 255,0,0 ; Text gw-200,50, "Bone-Mode" ; If differentVertexMode > 0 ; Color 0,255,255 ; ln=len("Vertex differentiation mode") ; Text (gw2-(ln/2)),50, "Vertex differentiation mode" ; COLOR 180,180,180 ; ln=len("select vertex with LMB, toggle through list with L") ; Text (gw2-(ln/2)),70, "select vertex with LMB, toggle through list with L" ; ; ENDIF ; Color 180,180,180 ; Text gw-200,70, "weight# = "+weight# ; ENDIF Color 255,60,40 Rect gw-20,30,20,20 Color 255,100,30 Rect gw-20,50,20,20 Color 255,160,20 Rect gw-20,70,20,20 Color 255,210,10 Rect gw-20,90,20,20 Color 255,255,0 Rect gw-20,110,20,20 Color 25,240,120 Rect gw-20,130,20,20 Color 30,200,150 Rect gw-20,150,20,20 Color 40,130,150 Rect gw-20,170,20,20 Color 50,70,140 Rect gw-20,190,20,20 Color 65,60,90 Rect gw-20,210,20,20 Color 255, 0, 255 Text 10,50, "Parent" Color 0,255,0 Text 10,70,"Child" Color 255,0,0 Text 10,90,"Selcted Bone" Color 0,0,255 Text 10,110, "Unselected Bones" Color 255,255,255 Text 10,130,"Unselected Vertices" Color 255,255,0 Text 10,150,"Selected Vertices" Color 180,180,180 Text 10,170,"Press F1 for Help" End If ;------------------------------------------------------------------------------------------------------------- ;#End Region ;#Region Small GUI xpressm = 0 xpressp = 0 ypressm = 0 ypressp = 0 zpressm = 0 zpressp = 0 colR = 3 colG = Int($3D) colB = Int($4E) If bonemodus = 1 Then DrawButton b2Xpos,b2ypos-24 ,82,b2dh,colR,colG,colB," Move" If bonemodus = 2 Then DrawButton b2Xpos,b2ypos-24 ,82,b2dh,colR,colG,colB,"Rotate" If aktbonespeed = 0 colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos,b2ypos-48 ,26,b2dh,colR,colG,colB," s" Else colR = 3 colG = Int($3D) colB = Int($4E) DrawButton b2Xpos,b2ypos-48 ,26,b2dh,colR,colG,colB," s" EndIf If aktbonespeed = 1 colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos+28,b2ypos-48 ,26,b2dh,colR,colG,colB,"m" Else colR = 3 colG = Int($3D) colB = Int($4E) DrawButton b2Xpos+28,b2ypos-48 ,26,b2dh,colR,colG,colB,"m" EndIf If aktbonespeed = 2 colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos+56,b2ypos-48 ,26,b2dh,colR,colG,colB," f" Else colR = 3 colG = Int($3D) colB = Int($4E) DrawButton b2Xpos+56,b2ypos-48 ,26,b2dh,colR,colG,colB," f" EndIf If MouseDown(1) And msx >= b2Xpos And msy >= b2ypos And msx <= b2Xpos+b2dw And msy <= b2ypos+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos,b2ypos ,b2dw,b2dh,colR,colG,colB," -X" xpressm = 1 Else colR = 255 colG = 0;INT($3D) colB = 0;INT($4E) DrawButton b2Xpos,b2ypos ,b2dw,b2dh,colR,colG,colB," -X" EndIf If MouseDown(1) And msx >= b2Xpos+b2dw+2 And msy >= b2ypos And msx <= b2Xpos+b2dw+2+b2dw And msy <= b2ypos+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos+b2dw+2,b2ypos ,b2dw,b2dh,colR,colG,colB," +X" xpressp = 1 Else colR = 255 colG = 0;INT($3D) colB = 0;INT($4E) DrawButton b2Xpos+b2dw+2,b2ypos ,b2dw,b2dh,colR,colG,colB," +X" EndIf If MouseDown(1) And msx >= b2Xpos And msy >= b2ypos+24 And msx <= b2Xpos+b2dw And msy <= b2ypos+24+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos,b2ypos+24 ,b2dw,b2dh,colR,colG,colB," -Y" ypressm = 1 Else colR = 0 colG = 255;INT($3D) colB = 0;INT($4E) DrawButton b2Xpos,b2ypos+24 ,b2dw,b2dh,colR,colG,colB," -Y" EndIf If MouseDown(1) And msx >= b2Xpos+b2dw+2 And msy >= b2ypos+24 And msx <= b2Xpos+b2dw+2+b2dw And msy <= b2ypos+24+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos+b2dw+2,b2ypos+24 ,b2dw,b2dh,colR,colG,colB," +Y" ypressp = 1 Else colR = 0 colG = 255;INT($3D) colB = 0;INT($4E) DrawButton b2Xpos+b2dw+2,b2ypos+24 ,b2dw,b2dh,colR,colG,colB," +Y" EndIf If MouseDown(1) And msx >= b2Xpos And msy >= b2ypos+48 And msx <= b2Xpos+b2dw And msy <= b2ypos+48+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos,b2ypos+48 ,b2dw,b2dh,colR,colG,colB," -Z" zpressm = 1 Else colR = 0 colG = 0;INT($3D) colB = 255;INT($4E) DrawButton b2Xpos,b2ypos+48 ,b2dw,b2dh,colR,colG,colB," -Z" EndIf If MouseDown(1) And msx >= b2Xpos+b2dw+2 And msy >= b2ypos+48 And msx <= b2Xpos+b2dw+2+b2dw And msy <= b2ypos+48+b2dh colR = Int($3D) colG = 3 colB = Int($4E) DrawButton b2Xpos+b2dw+2,b2ypos+48 ,b2dw,b2dh,colR,colG,colB," +Z" zpressp = 1 Else colR = 0 colG = 0;INT($3D) colB = 255;INT($4E) DrawButton b2Xpos+b2dw+2,b2ypos+48 ,b2dw,b2dh,colR,colG,colB," +Z" EndIf ; IF mousedown(1) and msx >= 0 and msy >= gh-15 ; frameX = msx ; Color 3,$3D,$4E ; RECT 0,gh-20,gw,20,0 ; Color 255,0,0 ; Rect frameX,gh-20,1,20,1 ; FrameProz = (frameX*100)/gw ; aktframenum = ((AnimFrames*FrameProz)/100)+1 ; Gosub ShowFrame ; else ; ; Color 3,$3D,$4E ; RECT 0,gh-20,gw,20,0 ; Color 255,0,0 ; Rect frameX,gh-20,1,20,1 ; Color 255,255,255 ; RECT MOUSEX()-10,MOUSEY(),20,1,1 ; RECT MOUSEX(),MOUSEY()-10,1,20,1 ; endif ;------------------------------------------------------------------------------------------------------------- ;#End Region aktMenu=RenderMenu() Rect MouseX()-10,MouseY(),20,1,1 Rect MouseX(),MouseY()-10,1,20,1 ; Flip If KeyHit(Key_X) And KeyDown(KEY_CTRL_LEFT) Then SaveBuffer FrontBuffer(), "screenshot.bmp" End If FlushKeys Cls Forever .aus1 FlushKeys ; save and quit For Node.Node = Each Node tempbank = node\ChunkNodeBank FreeBank tempbank tempbank = node\childbank FreeBank tempbank tb =node\bonebank FreeBank tb tb =node\key1bank FreeBank tb tb =node\key2bank FreeBank tb tb =node\key3bank FreeBank tb Next For tris.tris = Each tris FreeBank tris\vxbank Next .auscl FreeBank bnx FreeBank bn2 FreeFont font FreeFont bigfont End ; ; ;#End Region ;#Region AnimLoop ;#Region Init AnimLoop ; AnimLoop ::::::::::: .AnimLoop aktualModus = 2 For I=0 To MnuCount(Mnu$(0)) mnu$(i) = "" Next ; Initialisieren HideEntity darky Dim FRposX#(ANIMframes+1 ,AnzNodes) Dim FRposY#(ANIMframes+1 ,AnzNodes) Dim FRposZ#(ANIMframes+1 ,AnzNodes) Dim FRposDO(ANIMframes+1 ,AnzNodes) Dim FRscaleX#(ANIMframes+1 ,AnzNodes) Dim FRscaleY#(ANIMframes+1 ,AnzNodes) Dim FRscaleZ#(ANIMframes+1 ,AnzNodes) Dim FRscaleDO(ANIMframes+1 ,AnzNodes) Dim FRrotW#(ANIMframes+1 ,AnzNodes) Dim FRrotX#(ANIMframes+1 ,AnzNodes) Dim FRrotY#(ANIMframes+1 ,AnzNodes) Dim FRrotZ#(ANIMframes+1 ,AnzNodes) Dim FRrotDO(ANIMframes+1 ,AnzNodes) Dim FReuX#(ANIMframes+1 ,AnzNodes) Dim FReuY#(ANIMframes+1 ,AnzNodes) Dim FReuZ#(ANIMframes+1 ,AnzNodes) Dim FReuDO(ANIMframes+1 ,AnzNodes) Dim STOREposX#(ANIMframes+1 ,AnzNodes) Dim STOREposY#(ANIMframes+1 ,AnzNodes) Dim STOREposZ#(ANIMframes+1 ,AnzNodes) Dim STOREposDO(ANIMframes+1 ,AnzNodes) Dim STOREscaleX#(ANIMframes+1 ,AnzNodes) Dim STOREscaleY#(ANIMframes+1 ,AnzNodes) Dim STOREscaleZ#(ANIMframes+1 ,AnzNodes) Dim STOREscaleDO(ANIMframes+1 ,AnzNodes) Dim STORErotW#(ANIMframes+1 ,AnzNodes) Dim STORErotX#(ANIMframes+1 ,AnzNodes) Dim STORErotY#(ANIMframes+1 ,AnzNodes) Dim STORErotZ#(ANIMframes+1 ,AnzNodes) Dim STORErotDO(ANIMframes+1 ,AnzNodes) Dim STOREeuX#(ANIMframes+1 ,AnzNodes) Dim STOREeuY#(ANIMframes+1 ,AnzNodes) Dim STOREeuZ#(ANIMframes+1 ,AnzNodes) Dim STOREeuDO(ANIMframes+1 ,AnzNodes) For i = 0 To animframes For j = 0 To AnzNodes FRposX#(i ,j) = 0 FRposY#(i ,j) = 0 FRposZ#(i ,j) = 0 FRposDO(i ,j) = 0 FRscaleX#(i ,j) = 0 FRscaleY#(i ,j) = 0 FRscaleZ#(i ,j) = 0 FRscaleDO(i ,j) = 0 FRrotW#(i ,j) = 0 FRrotX#(i ,j) = 0 FRrotY#(i ,j) = 0 FRrotZ#(i ,j) = 0 FRrotDO(i ,j) = 0 FReuX#(i ,j) = 0 FReuY#(i ,j) = 0 FReuZ#(i ,j) = 0 FReuDO(i ,j) = 0 Next Next test2fr = 0 If hasanim > 0 cnode = 0 For node.node = Each node tempbank = node\key1bank size = BankSize(tempbank) If size > 0 Blocksize = 16 K1anz = (size/Blocksize)-1 For z = 0 To K1anz tmpframe = GetBlockInt( tempbank, z, Blocksize, 0 ) If tmpframe <= AnimFrames FRposX#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 4) FRposY#(tmpframe,cnode) = GetBlockFloat#( tempbank, z, Blocksize, 8) FRposZ#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 12 ) FRposDO(tmpframe,cnode) = 1 test2fr = test2fr + 1 EndIf If tmpframe = 0 Then FrameStart = 0 Next EndIf tempbank = node\key2bank size = BankSize(tempbank) If size > 0 Blocksize = 16 K2anz = (size/Blocksize)-1 For z = 0 To K2anz tmpframe = GetBlockInt( tempbank, z, Blocksize, 0 ) If tmpframe <= AnimFrames FRscaleX#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 4) FRscaleY#(tmpframe,cnode) = GetBlockFloat#( tempbank, z, Blocksize, 8) FRscaleZ#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 12 ) FRscaleDO(tmpframe,cnode) = 1 test2fr = test2fr + 1 EndIf If tmpframe = 0 Then FrameStart = 0 Next EndIf tempbank = node\key3bank size = BankSize(tempbank) If size > 0 Blocksize = 20 K3anz = (size/Blocksize)-1 For z = 0 To K3anz tmpframe = GetBlockInt( tempbank, z, Blocksize, 0 ) If tmpframe <= AnimFrames FRrotW#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 4) FRrotX#(tmpframe,cnode) = GetBlockFloat#( tempbank, z, Blocksize, 8) FRrotY#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 12 ) FRrotZ#(tmpframe,cnode) = GetBlockFloat#( tempbank, z,Blocksize, 16 ) FRrotDO(tmpframe,cnode) = 1 FReuDO(tmpframe,cnode) = 1 test2fr = test2fr + 1 EndIf If tmpframe = 0 Then FrameStart = 0 Next EndIf cnode = cnode+1 Next node.node = First node EndIf .spring KeyIsLoad = 1 aktframenum = 1 animmodus = 1 filename$ = "Temp.b3d" saveQuestion = 0 Gosub saveall FreeEntity theanim theanim = LoadAnimMesh(filename$) EntityFX theanim, fx ShowEntity theanim HideEntity anim0 ;EntityFX theanim,17 ;EntityOrder theanim, 10 EntityAlpha theAnim, 0.0 ShowEntity darky SetFont bigfont st$ = "Calculate now Bone positions" ln = StringWidth(st$) Text gw2-(ln/2),gh2, st$ SetFont font Flip bn = CreateBank(100) If AnimFrames > 0 Dim sq(AnimFrames) For exf = 0 To AnimFrames sq(exf) = ExtractAnimSeq(theanim,exf,exf) ;FRkeySEQ$(exf) = exf Animate theanim,3,1,sq(exf) ;UPDATEWORLD ;RENDERWORLD cnode = 0 For node.node = Each node node\bsphereparent = FindChild(theanim,node\name) MemoryToBank(bn,node\bsphereparent,100) FRposX#(exf ,cnode) = PeekFloat(bn,16*4) FRposY#(exf ,cnode) = PeekFloat(bn,17*4) FRposZ#(exf ,cnode) = PeekFloat(bn,18*4) If exf <= 1 Then FRposDO(exf ,cnode) = 1 ; IF exf > 1 ; IF FRposX#(exf-1 ,cnode) = FRposX#(exf ,cnode) AND FRposY#(exf-1 ,cnode) = FRposY#(exf ,cnode) AND FRposZ#(exf-1 ,cnode) = FRposZ#(exf ,cnode) ; FRposDO(exf ,cnode) = 0 ; ELSE ; FRposDO(exf ,cnode) = 1 ; ENDIF ; ; ENDIF FRscaleX#(exf ,cnode) = PeekFloat(bn,19*4) FRscaleY#(exf ,cnode) = PeekFloat(bn,20*4) FRscaleZ#(exf ,cnode) = PeekFloat(bn,21*4) If exf <= 1 Then FRscaleDO(exf ,cnode) = 1 ; IF exf > 1 ; IF FRscaleX#(exf-1 ,cnode) = FRscaleX#(exf ,cnode) AND FRscaleY#(exf-1 ,cnode) = FRscaleY#(exf ,cnode) AND FRscaleZ#(exf-1 ,cnode) = FRscaleZ#(exf ,cnode) ; FRscaleDO(exf ,cnode) = 0 ; ELSE ; FRscaleDO(exf ,cnode) = 1 ; ENDIF ; ENDIF FRrotW#(exf ,cnode) = PeekFloat(bn,12*4) FRrotX#(exf ,cnode) = PeekFloat(bn,13*4) FRrotY#(exf ,cnode) = PeekFloat(bn,14*4) FRrotZ#(exf ,cnode) = PeekFloat(bn,15*4) If exf <= 1 Then FRrotDO(exf ,cnode) = 1 : FReuDO(exf ,cnode) = 1 ; IF exf > 1 ; IF FRrotW#(exf-1 ,cnode) = FRrotW#(exf ,cnode) AND FRrotX#(exf-1 ,cnode) = FRrotX#(exf ,cnode) AND FRrotY#(exf-1 ,cnode) = FRrotY#(exf ,cnode) AND FRrotZ#(exf-1 ,cnode) <> FRrotZ#(exf ,cnode) ; FReuDO(exf ,cnode) = 0 ; FRrotDO(exf ,cnode) = 0 ; ELSE ; FReuDO(exf ,cnode) = 1 ; FRrotDO(exf ,cnode) = 1 ; ENDIF ; ENDIF FReuX#(exf ,cnode) = EntityPitch#(node\bsphereparent) FReuY#(exf ,cnode) = EntityYaw#(node\bsphereparent) FReuZ#(exf ,cnode) = EntityRoll#(node\bsphereparent) ;IF exf < 2 then FReuDO(exf ,cnode) = 1 STOREposX#(exf ,cnode) = FRposX#(exf ,cnode) STOREposY#(exf ,cnode) = FRposY#(exf ,cnode) STOREposZ#(exf ,cnode) = FRposZ#(exf ,cnode) STOREposDO(exf ,cnode) = FRposDO(exf ,cnode) STOREscaleX#(exf ,cnode) = FRscaleX#(exf ,cnode) STOREscaleY#(exf ,cnode) = FRscaleY#(exf ,cnode) STOREscaleZ#(exf ,cnode) = FRscaleZ#(exf ,cnode) STOREscaleDO(exf ,cnode) = FRscaleDO(exf ,cnode) STORErotW#(exf ,cnode) = FRrotW#(exf ,cnode) STORErotX#(exf ,cnode) = FRrotX#(exf ,cnode) STORErotY#(exf ,cnode) = FRrotY#(exf ,cnode) STORErotZ#(exf ,cnode) = FRrotZ#(exf ,cnode) STORErotDO(exf ,cnode) = FRrotDO(exf ,cnode) STOREeuX#(exf ,cnode) = FReuX#(exf ,cnode) STOREeuY#(exf ,cnode) = FReuY#(exf ,cnode) STOREeuZ#(exf ,cnode) = FReuZ#(exf ,cnode) STOREeuDO(exf ,cnode) = FReuDO(exf ,cnode) cnode = cnode + 1 Next ShowEntity darky SetFont bigfont st$ = "Calculate now Bone positions" ln = StringWidth(st$) Text gw2-(ln/2),gh2, st$ SetFont font Flip Next EndIf cnode = 0 For node.node = Each node node\bsphereparent = FindChild(theanim,node\name) node\bsphere = CreateSphere(6,node\bsphereparent) EntityPickMode Node\bSphere, 2,0 ScaleEntity Node\bSphere, scsph#, scsph#, scsph# ,1 PaintEntity Node\bSphere, blau MemoryToBank(bn,node\bsphereparent,100) ;Put in kernel32.decls file>> .lib "kernel32.dll" this line>> MemoryToBank(Destination*,Source,Length):"RtlMoveMemory" EntityOrder Node\bSphere,-10 cnode = cnode + 1 Next FreeBank bn node.node = First node aktframenum = 1 ShowEntity XYZ EntityAlpha theAnim ,1.0 EntityParent xyz,0 ScaleEntity xyz,scsph#*40, scsph#*40, scsph#*40 PositionEntity xyz,0,0,0,1 RotateEntity xyz,0,0,0,1 EntityParent xyz, Node\bSphere,0 Gosub ShowFrame frmCHG = 1 ; ;#End Region