Dark Bit Factory & Gravity

PROGRAMMING => Purebasic => Topic started by: padman on June 17, 2011

Title: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Hi guys!

Well, this is what it says in the topic.  ;D It's not picture perfect, especially the scroller (it ends and starts again, the original loops endlessly, hope you get what I mean  :xmas:). I couldn't be bothered to add that since this isn't Retro Remakes. (It's available in all it's glory there anyway...) But hey, you got the source, feel free to add that feature and post the code!  ;)

Enjoy!

Pad :)

Code: [Select]
;##########################################################################################
;# Yet another quick and crap cracktro remake by Padman. (c)06/2011                       #
;# Libminifmod170 by rbz is used for music replay.                                        #                                       
;# Out of laziness I also used a slightly tweaked sine scroller routine by Shockwave,     #
;# which can be found here: http://www.dbfinteractive.com/forum/index.php?topic=1436.0.   #
;########################################################################################## 






Global  xres.w , yres.w , loop.w ,xp.w , yp.w , t.s , tptr.w , sco.b

xres  = 640           
yres  = 480           
sco   = 0
tptr  = 1
FPS = 60
TimerDuration = 1000 / FPS

IncludeFile "scroll.pbi"                             
IncludeFile "libminifmod170.pbi"



InitSprite()                     
InitKeyboard()                 
   

Dim gfxfont(60)               
         
 

window = OpenScreen( xres , yres , 16 , "Paradox Fucktro")     

If window = 0                                           
  MessageRequester("Error", "This is fucked up, I can't open the window", 0)       
  End                                                   
EndIf



font = CatchImage (#PB_Any, ?font)   

StartDrawing (ScreenOutput())                         
  DrawImage (ImageID(font),0,0)                       
StopDrawing()

xp = 0
yp = 0





For loop =1 To 60                                     
  gfxfont(loop) = GrabImage(font,#PB_Any,xp,yp,31,31)   
  xp = xp + 32                                         
  ;                                                   
  If xp > = 320
    yp = yp + 32
    xp = 0
  EndIf
Next



CatchSprite(0,?one)
CatchSprite(1,?two)
CatchSprite(2,?three)
CatchSprite(3,?foot)
CatchSprite(4,?logo) 




  MiniFmod_Init(?mod,?endmod-?mod)
  MiniFmod_Play()

Repeat
 
  timer = ElapsedMilliseconds()   
  ClearScreen($0)                                       
  ExamineKeyboard()                                     




AnimDelay + 1
 
   
             If AnimDelay = 7
                  AnimDelay = 0
   
   
             
                AnimFrame + 1
                EndIf
      If AnimFrame = 3 : AnimFrame=0 : EndIf     




  StartDrawing (ScreenOutput())                       
    cco = 0
   

 
    For cc = 0 To 30
      letter = (Asc(UCase(Mid(t.s, tptr+cc, 1)))-31)
      DrawImage (ImageID(gfxfont(letter)), 310+300*-Sin((sco+cco)/180), 270+160*Cos((cco+sco)/180))
      cco = cco + 42
    Next
   
   
    sco = sco -2
   
    If sco < -32
      tptr = tptr + 1
      sco=sco + 42
    EndIf
   
   

   
    If tptr > (Len(t.s)-30)
      tptr = 1
    EndIf
  StopDrawing()                                       


DisplayTransparentSprite(animframe,128,97)
DisplaySprite(3,(640-SpriteWidth(3))/2,386)
DisplayTransparentSprite(4,(640-SpriteWidth(4))/2,0)



 TimeGap = TimerDuration - (ElapsedMilliseconds() - Timer)

  If TimeGap > 16
 
    Delay( TimeGap - 10 )
  EndIf




  FlipBuffers()                                       

Until KeyboardPushed (#PB_Key_Escape)               

 MiniFmod_Stop()
 MiniFmod_Free()

End

DataSection
one:  IncludeBinary "prd1.bmp"
two:  IncludeBinary "prd2.bmp"
three: IncludeBinary "prd3.bmp"
foot: IncludeBinary "foot.bmp"
font: IncludeBinary "font.bmp"
logo: IncludeBinary "logo.bmp"
mod: IncludeBinary "angels.xm"
endmod:
EndDataSection

                 
[Edit]

jace_stknights pointed out to me that:

Code: [Select]
StartDrawing (ScreenOutput())                         
  DrawImage (ImageID(font),0,0)                       
StopDrawing()

isn't needed. He's of course right. You can grab an image without displaying it first, other than Grabsprite(), where you have to display the sprite. So feel free to delete that part! ;)



     
   

 
   
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Hotshot on June 17, 2011
Very good

It seem to me that it is your Purebasic framework of making Demo :) ;)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Thanks! :)

I wouldn't call that mess a framework though. It's just how my PB sources look like. Init stuff, load sprites, main loop, datasection...  ;)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Raizor on June 17, 2011
Crashes for me Padman :(
Get a black screen, which switches back to the desktop then about 3 seconds of audio and then it crashes out:

"pdx.exe has stopped working"
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Oopsie daisy. What OS are you on? It's probably that stone old zoomsprite function. :whack: I'll look into it, though I get no errors in the debugger here and it runs just fine.



[Edit]:  I removed the zoomsprite routine. It wasn't really needed anyway and if I remember correctly I already had problems with that once. New zip is in the first post. Hope it'll work now (though my AV complains about the UPX(?) packed file...  ::)) Anyway, I don't spot any other oddities in the code.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Raizor on June 17, 2011
Oopsie daisy. What OS are you on? It's probably that stone old zoomsprite function. :whack: I'll look into it, though I get no errors in the debugger here and it runs just fine.



[Edit]:  I removed the zoomsprite routine. It wasn't really needed anyway and if I remember correctly I already had problems with that once. New zip is in the first post. Hope it'll work now (though my AV complains about the UPX(?) packed file...  ::)) Anyway, I don't spot any other oddities in the code.

Same as before I'm afraid. I'm on Win 7 x64.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Have you tried to run the file in XP compatibilty mode? This is really strange, I don't see anything special that could cause the problem.  :telloff:
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: KrazyK on June 17, 2011
Same error here on Win7 x64, but I've ran the code supplied and it it appears to be the screen depth of 32 that was causing the errors. 
Changing it to 16 works fine.

Code: [Select]
window = OpenScreen( xres , yres , 16 , "Paradox Fucktro")     
Or

Windowed mode:
Code: [Select]
;window = OpenScreen( xres , yres , 16 , "Paradox Fucktro")
window = OpenWindow(99,0,0,xres,yres,"",#PB_Window_ScreenCentered|#PB_Window_WindowCentered|#PB_Window_BorderLess)
OpenWindowedScreen(WindowID(99),0,0,xres,yres,0,0,0)
ShowCursor_(0)

I've attached the windowed one here.

[Edit] Attached the fullscreen version now.   16bit depth 8 bit colour gfx.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Thanks for testing (and fixing) it mate! K+  :)
That's a strange problem though.  Must be a Purebasic bug that only shows on x64 systems then. I mean a screen depth of 32 is more common these days than 16 isn't it?!? Or maybe it has to do with the fact that the used BMPs are mixed 2/8/24bit? Don't understand why it's working on XP then without any problems. I'm confused. Anyway, thanks again!


[Edit:] I attached a file with a screen depth of 32bit, where all bmp's are 24bit. Would be nice if someone of you x64 guys could test it and tell me if that cures the problem too!
[Edit:] File removed, working binary and source in first post.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Raizor on June 17, 2011
[Edit:] I attached a file with a screen depth of 32bit, where all bmp's are 24bit. Would be nice if someone of you x64 guys could test it and tell me if that cures the problem too!

KrazyK's version works for me. Same problem with this new one Padman.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Crap, thanks for testing! I wouldn't have had a chance to find it out myself without you guys! I don't understand it, but from now on I'll use a 16bit screen for x64 systems compatibility then... Fixed code & zip file in first post.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Shockwave on June 17, 2011
Excellent!

Amazingly I don't think this cracktro even exists on Retro-Remakes and it must be one of the most famous of all.
Thanks for sharing it with us, K+
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 17, 2011
Thanks for the Karma!  :)  It does exist on RR since 2010 (and as a 1:1 version unlike this one  ;D) But yeah, it took some time until Stormbringer remade it...  ;)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Shockwave on June 17, 2011
Lol I hadn't seen the 1:1 - This will do for me anyway :)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: benny! on June 18, 2011
Cool, K++ for sharing sources!
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 18, 2011
Thanks!  :)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Dr.Death on June 20, 2011
My all time fav m8 thanx for the code... :updance:
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 20, 2011
Hehe, yw!  :)
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: neumanix on June 22, 2011
Nice one!
I was amazed at how effective the UPX compressor is. I compiled in v4.51, got an exe of 1.55MB and UPX shrunk it to 60Kb.
How did you get it to 47Kb btw? Older version of PB?
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: padman on June 22, 2011
Thanks!
I used PB 4.41, but I think that doesn't really matter.  It's probably because of the UPX settings I used. I don't remember them exactly, but I remember having used compression level "best". Most of the 1.55MB is caused by the 24bit pics anyway and BMPs are usually crunched at a pretty good ratio.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: hawk78 on January 06, 2012
Great!!! Thanks for sharing!  :updance:

Hawk78
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Dad1916 on November 24, 2013
Very nice, thanks padman. I got this working on PureBasic 5.21 LTS (MacOS X - x64) by:

-removing the music mod lib (windows only I believe).
-Changing the openScreen() from 16 to 32.
-Modifying the dataSection.

main file with mods below :

Code: [Select]
;##########################################################################################
;# Yet another quick and crap cracktro remake by Padman. (c)06/2011                       #
;# Libminifmod170 by rbz is used for music replay.                                        #                                       
;# Out of laziness I also used a slightly tweaked sine scroller routine by Shockwave,     #
;# which can be found here: http://www.dbfinteractive.com/forum/index.php?topic=1436.0.   #
;########################################################################################## 



Global  xres.w , yres.w , loop.w ,xp.w , yp.w , t.s , tptr.w , sco.b

xres  = 640           
yres  = 480           
sco   = 0
tptr  = 1
FPS = 60
TimerDuration = 1000 / FPS

IncludeFile "scroll.pbi"                             



InitSprite()                     
InitKeyboard()                 
   

Dim gfxfont(60)               
         
 

window = OpenScreen( xres , yres , 32 , "Paradox Fucktro")     

If window = 0                                           
  MessageRequester("Error", "This is fucked up, I can't open the window", 0)       
  End                                                   
EndIf



font = CatchImage (#PB_Any, ?font)   

StartDrawing (ScreenOutput())                         
  DrawImage (ImageID(font),0,0)                       
StopDrawing()

xp = 0
yp = 0





For loop =1 To 60                                     
  gfxfont(loop) = GrabImage(font,#PB_Any,xp,yp,31,31)   
  xp = xp + 32                                         
  ;                                                   
  If xp > = 320
    yp = yp + 32
    xp = 0
  EndIf
Next



CatchSprite(0,?one)
CatchSprite(1,?two)
CatchSprite(2,?three)
CatchSprite(3,?foot)
CatchSprite(4,?logo) 



Repeat
 
  timer = ElapsedMilliseconds()   
  ClearScreen($0)                                       
  ExamineKeyboard()                                     




AnimDelay + 1
 
   
             If AnimDelay = 7
                  AnimDelay = 0
   
   
             
                AnimFrame + 1
                EndIf
      If AnimFrame = 3 : AnimFrame=0 : EndIf     




  StartDrawing (ScreenOutput())                       
    cco = 0
   

 
    For cc = 0 To 30
      letter = (Asc(UCase(Mid(t.s, tptr+cc, 1)))-31)
      DrawImage (ImageID(gfxfont(letter)), 310+300*-Sin((sco+cco)/180), 270+160*Cos((cco+sco)/180))
      cco = cco + 42
    Next
   
   
    sco = sco -2
   
    If sco < -32
      tptr = tptr + 1
      sco=sco + 42
    EndIf
   
   

   
    If tptr > (Len(t.s)-30)
      tptr = 1
    EndIf
  StopDrawing()                                       


DisplayTransparentSprite(animframe,128,97)
DisplaySprite(3,(640-SpriteWidth(3))/2,386)
DisplayTransparentSprite(4,(640-SpriteWidth(4))/2,0)



 TimeGap = TimerDuration - (ElapsedMilliseconds() - Timer)

  If TimeGap > 16
 
    Delay( TimeGap - 10 )
  EndIf




  FlipBuffers()                                       

Until KeyboardPushed (#PB_Key_Escape)               

End
DataSection
one: : IncludeBinary "prd1.bmp"
two:  : IncludeBinary "prd2.bmp"
three: : IncludeBinary "prd3.bmp"
foot: : IncludeBinary "foot.bmp"
font: : IncludeBinary "font.bmp"
logo: : IncludeBinary "logo.bmp"
mod: : IncludeBinary "angels.xm"
endmod:
EndDataSection
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: jace_stknights on December 13, 2013
There are some nasty bugs on OSX version of Purebasic. I've tried to port some of my remake on it, but I must admit sometimes things are not running at they should...
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: Teddy Rogers on February 23, 2014
I remember when I saw this released many years back on the Amiga. Thank you for the memories, excellent!

Ted.
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: ~Ar-S~ on October 15, 2015
 :clap: :clap: :clap: I remember too ! This startro is EPIC !
Thanks for sharing it
Title: Re: Paradox Fucktro remake + Purebasic Source code
Post by: speedhead on December 23, 2016
music "Iruiru" by Speedhead. Re-Used/Remixed in the famous Paradox Angels Fucktro by Samplemixer

 :clap: