Dark Bit Factory & Gravity

PROGRAMMING => Purebasic => Topic started by: padman on October 04, 2014

Title: Skid Row remake + PureBasic source code
Post by: padman on October 04, 2014
Hi all,

Well, what can I say. I was bored, so I decided to code something. This is the outcome.

Required files + compiled executable available in the ZIP archive.

Enjoy!  :cheers:

Code: [Select]
;******************************************************************************************
;* Pretty much a 1:1 conversion of Ayoros' CODEF remake at http://www.wab.com/?screen=245 *
;* with some minor modifications.                                                         *
;* SC68 tune originally ripped by Stormbringer                                            *
;* Quickly hacked together & compiled with PureBasic 5.30 x86 by Padman in 2014.          *                                                   
;* Exe size ~75Kb UPX'ed. Not too bad, eh? ^^                                             *
;******************************************************************************************


XIncludeFile "sc68_replay.pbi"

If InitSprite() = 0 Or InitKeyboard() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf



If OpenScreen(800, 600, 32, "Skid Row Remake")

  CatchSprite(0,?s) : CatchSprite(1,?k) : CatchSprite(2,?i) : CatchSprite(3,?d) : CatchSprite (4,?r) : CatchSprite(5,?o) : CatchSprite(6,?w)
  CatchSprite(7,?txt1) : CatchSprite (8,?txt2) :CatchSprite(10,?backgr)
 
  For sprite = 0 To 6
    TransparentSpriteColor(sprite,$FFFFFF)   ; Set transparency to white
  Next
 
  TransparentSpriteColor(7,$FF00FF) :  TransparentSpriteColor(8,$FF00FF) ; Set transparency to purple
 
  CreateSprite(20,720,249)  ; Create sprite for scanline effect
  StartDrawing(SpriteOutput(20))
  Box(0,0,720,240,$FFFFFF)
  For i=0 To 240 Step 2
    Line(0,i,720,1,$000000)
  Next
  StopDrawing()
  TransparentSpriteColor(20,$FFFFFF) ; Set transparency to white
 
   
 sc68replay_Init(?tune , ?tuneend-?tune, #SC68Replay_Memory)   ; Init tune
 sc68replay_Play() ; Start tune
 
 
Repeat
   
   
   
    FlipBuffers()
   
    ClearScreen(RGB(0,0,0))
   
        DisplaySprite(10,40,180)  ; Background

        DisplayTransparentSprite(0,350 + 270 * Sin(angle.f), 190+15,fade)    ;S
        DisplayTransparentSprite(1,360 + 190 * Sin(angle.f), 197+15,fade)    ;k
        DisplayTransparentSprite(2,386 + 130 * Sin(angle.f), 209+15,fade)    ;i
        DisplayTransparentSprite(3,360 + 70 *  Sin(angle.f), 197+15,fade)    ;d
   
        DisplayTransparentSprite(6,340 - 260 * Sin(angle.f), 254+15,fade)     ;R
        DisplayTransparentSprite(5,350 - 166 * Sin(angle.f), 255+15,fade)     ;o
        DisplayTransparentSprite(4,340 - 70 *  Sin(angle.f), 198+15,fade)     ;w
   
    angle.f= angle.f+ 0.035
   

   
   
  If vbl>=200 And  vbl<700 :  DisplayTransparentSprite(7,40,165+25) : EndIf  ; Text page 1
  If vbl>=700 And  vbl<1100 : DisplayTransparentSprite(8,40,164+15) : EndIf  ; Text page 2
  If vbl>=1100 : vbl=0 : EndIf
 
  vbl=vbl+1
  If fade<255
      fade=fade+5
   Else 
      fade=255
  EndIf 
 
       DisplayTransparentSprite(20,40,180)
  ExamineKeyboard()
  Until KeyboardPushed(#PB_Key_Escape)
 
  sc68replay_Stop()  ; Stop tune
   
 Else
  MessageRequester("Error", "Can't open a 800*600 - 32 bit screen !", 0)
  EndIf


DataSection
 
  backgr:   
  IncludeBinary "res/backgr.bmp"
  txt1:   
  IncludeBinary "res/txt1.bmp"
  txt2:   
  IncludeBinary "res/txt2.bmp"
  s:     
  IncludeBinary "res/s.bmp"
  k:     
  IncludeBinary "res/k.bmp"
  i:     
  IncludeBinary "res/i.bmp"
  d:     
  IncludeBinary "res/d.bmp"
  r:
  IncludeBinary "res/r.bmp"
  o:
  IncludeBinary "res/o.bmp"
  w:
  IncludeBinary "res/w.bmp"
  tune:
  IncludeBinary "res/tune.sc68"
  tuneend:
 
EndDataSection 

[Edit] Typos and other cock-ups fixed.  ::)
Title: Re: Skid Row remake + PureBasic source code
Post by: Majikeyric on October 04, 2014
Very nice! :carrot:
Title: Re: Skid Row remake + PureBasic source code
Post by: Hotshot on October 05, 2014
Nice one padman and love the music :)
Title: Re: Skid Row remake + PureBasic source code
Post by: padman on October 05, 2014
Thanks guys! :)

@inc: Thanks mate, but to keep my thread clean I moved your post here. (http://www.dbfinteractive.com/forum/index.php?topic=6270.0)
Title: Re: Skid Row remake + PureBasic source code
Post by: Kirl on October 05, 2014
Hoi, very nice! Excellent work good sir!  :cheers:
I was thinking how this came at exactly the right time, until I realised that any time is good demo time! That said, perfect timing! ;)

I also had a long lost memory popup about how I laboriously typed over a tunnel flying game in visual basic (I think it was) in hopes of learning programming. This was way before more succesfull efforts. Random memory popup...  :)
Title: Re: Skid Row remake + PureBasic source code
Post by: padman on October 06, 2014
Quote
any time is good demo time!

Word! Thanks mate! :)
Title: Re: Skid Row remake + PureBasic source code
Post by: Dr.Death on October 07, 2014
Good job mate. It's nice to see something off you  :updance:
Title: Re: Skid Row remake + PureBasic source code
Post by: ttemper on October 11, 2014
very nice :) simple but effective.
Title: Re: Skid Row remake + PureBasic source code
Post by: Raizor on October 15, 2014
Very cool! I remember watching the original, many years ago. Lovely as always, Padman :) K++
Title: Re: Skid Row remake + PureBasic source code
Post by: padman on October 17, 2014
Thanks guys!  :)
Title: Re: Skid Row remake + PureBasic source code
Post by: jace_stknights on October 17, 2014
Nice :D
I would have code something, but... I'm too lazyyyyyy  :crutches:
Title: Re: Skid Row remake + PureBasic source code
Post by: Dad1916 on December 04, 2014
Nice and thanks for sharing.

When attempting to compile I am having a problem with sc68replay.lib . I believe it's built for something other than Mac Os X. Is my assumption correct? I've search but am unsure as to where  I download and compile this lib.

thnkas.
Title: Re: Skid Row remake + PureBasic source code
Post by: inc. on December 04, 2014
You may compile the source in Windows. Also Check your purebasic Version.

Cheers
Title: Re: Skid Row remake + PureBasic source code
Post by: Dad1916 on December 04, 2014
You may compile the source in Windows. Also Check your purebasic Version.

Cheers
thanks for the reply. I want to compile the lib under Mac os X . I'm using PureBasic 5.31 (MacOS X - x64). Where is the lib source ?
Title: Re: Skid Row remake + PureBasic source code
Post by: inc. on December 04, 2014
maybe "padman" is a gentleman and provide the lib (if he wrote the LIB? ) . you may ask him
Title: Re: Skid Row remake + PureBasic source code
Post by: Dad1916 on December 04, 2014
maybe "padman" is a gentleman and provide the lib (if he wrote the LIB? ) . you may ask him

From what I can make out StormBringer wrote the Freebasic version http://www.dbfinteractive.com/forum/index.php?topic=3030.5
I'll pm PadMan and see how I progress.
Thanks.
Title: Re: Skid Row remake + PureBasic source code
Post by: AmigaJoker on April 20, 2015
A get following error message...

Line 54: DisplayTransparentSprite(): Incorrect numbers of parameters.
Title: Re: Skid Row remake + PureBasic source code
Post by: padman on April 20, 2015
Quote
A get following error message...

Line 54: DisplayTransparentSprite(): Incorrect numbers of parameters.

I guess you are using a too old version of PB then. The sprite commands have been changed. I think this happened with version 5.20. Make sure to use a current version,  i.e. 5.24 LTS or  5.31, to compile the source.
Title: Re: Skid Row remake + PureBasic source code
Post by: AmigaJoker on April 23, 2015

I guess you are using a too old version of PB then. The sprite commands have been changed. I think this happened with version 5.20. Make sure to use a current version,  i.e. 5.24 LTS or  5.31, to compile the source.

Aha... im using a very old version (4.51). So I have to update asap  :cheers:
Title: Re: Skid Row remake + PureBasic source code
Post by: emook on April 28, 2015
Very nice remake.

I would suggest using a real timer than an incremental variable so that timing is maintained across all cpus :

Code: [Select]
start=(ElapsedMilliseconds()/30)
 
  Repeat
   
    vbl=(ElapsedMilliseconds()/30)-start
   
    FlipBuffers()
   
    ClearScreen(RGB(0,0,0))
   
    DisplaySprite(10,40,180)  ; Background
   
    ssin.f = Sin(angle.f)
   
    DisplayTransparentSprite(0,350 + 270 * ssin, 190+15,fade)    ;S
    DisplayTransparentSprite(1,360 + 190 * ssin, 197+15,fade);k
    DisplayTransparentSprite(2,386 + 130 * ssin, 209+15,fade);i
    DisplayTransparentSprite(3,360 + 70 *  ssin, 197+15,fade);d
   
    DisplayTransparentSprite(6,340 - 260 * ssin, 254+15,fade)     ;R
    DisplayTransparentSprite(5,350 - 166 * ssin, 255+15,fade)     ;o
    DisplayTransparentSprite(4,340 - 70 *  ssin, 198+15,fade)     ;w
   
    angle.f= angle.f+ 0.035

    If vbl>=35 And  vbl<135 :  DisplayTransparentSprite(7,40,165+25) : EndIf  ; Text page 1
    If vbl>=135 And  vbl<265 : DisplayTransparentSprite(8,40,164+15) : EndIf  ; Text page 2
    If vbl>=295 : start=(ElapsedMilliseconds()/30) : EndIf
   
    If fade<255
      fade=fade+5
    Else 
      fade=255
    EndIf 
   
    DisplayTransparentSprite(20,40,180)
    ExamineKeyboard()
   
  Until KeyboardPushed(#PB_Key_Escape)
Title: Re: Skid Row remake + PureBasic source code
Post by: ~Ar-S~ on October 15, 2015
Nice remake, thanks for sharing.
I add emook's mod with succes. :goodpost: