Dark Bit Factory & Gravity

PROGRAMMING => Purebasic => Topic started by: waste on October 13, 2017

Title: [Retroremake] Amstrad CPC for fun
Post by: waste on October 13, 2017
hi,

a very simple retroremake of the second demo by Logon System,

yes, i know, you won't learn anything with this code, it's for fun

no exe compiled, diy

if you know a way to rip font stuff from Amstrad it interests me ! you can see looking to the scrolltext that i find a dirty way to implement it !


original : https://www.youtube.com/watch?v=VBMEDJZ46zc

Code: [Select]

; Retro remake Démo n°2 Logon system @mstrad CPC 1988
; jmg@2017

Enumeration
  #scroll
  #chiptune1
EndEnumeration 

;-------------------------------Init---------------------------------------

InitMovie()
InitSprite()
EP_InitFXLib()
UsePNGImageDecoder()

text.s ="                                                             salut tous, petit retroremake purebasic Amstrad cpc " +
        "de la demo numero deux de  logon system je n'ai pas repris le texte du scrolling car trop long a taper de plus a cette epoque " +
        "le texte ne servait qu a illustrer les capacites techniques du scrolling la par exemple je fais du remplissage pour que vous " +
        "puissiez apprecier la musique qui d apres l auteur certaienement serge alias longshot est du jeu rampage "+
        "en fait c est rampart ce qui est pareil que rampage mais avec des chevaliers a la place des dinosaures bref "+
        "je vais m attaquer a un peu plus technique comme retroremake la prochaine fois j en profite pour remercier google " +
        "de m avoir supprime mon compte developpeur pour des raisons obscures  ce jour     c est pas demain que je vais faire " +
        "fortune avec mes applis android    pas grave l espoir fait vivre             "

MP_Graphics3D (759,545,0,1)
SetWindowTitle(0, "Logon Sytem démon N°2 1988 JmG@2017")

EP_CatchFont32(0,?font,?endfont-?font)

EP_SetScrollText(0,text )
EP_Create32Scroll(0, 0, 0, 485)
EP_SetScroll32Speed(0, 8)

LoadMovie(#chiptune1,"chiptune1.mp3")


one = MP_CatchSprite(?sprite,?endsprite-?sprite)
PlayMovie(#chiptune1,1)


Repeat
 
  event=WindowEvent()
 
  MP_DrawSprite(one,0,0)
 
  EP_Move32Scroll(0)
 
  MP_RenderWorld()
  MP_Flip () 
   
Until GetAsyncKeyState_(#VK_ESCAPE)



DataSection
  sprite:
  IncludeBinary "scr1.png"
  endsprite:
  chiptune:
  IncludeBinary "chiptune1.mp3"
  endchiptune:
  font:
  IncludeBinary "fnt.bmp"
  endfont:
EndDataSection


; End PB
; PureBasic 5.42 LTX (x86)


Title: Re: [Retroremake] Amstrad CPC for fun
Post by: ~Ar-S~ on February 12, 2018
Please add all libs needed in your zip...
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: waste on February 15, 2018
hi,

i don't know how to midify the previous .zip in attachment

mp3d needed

http://www.flasharts.de/mpz/mp33_beta/MP3D_Installer.exe


Title: Re: [Retroremake] Amstrad CPC for fun
Post by: inc. on February 16, 2018
 delete the attachment,  create a new zip with all needed files and attach it to your created post while Click on modify.
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: Bobo220673 on February 16, 2018
Hi!
Here is the Intro without Lib....

Code: [Select]
InitSprite()
InitKeyboard()
InitMovie()
UsePNGImageDecoder()

#SCREEN_CX=759
#SCREEN_CY=545

text.s =UCase("                                                             salut tous, petit retroremake purebasic Amstrad cpc" +
        " de la demo numero deux de  logon system je n'ai pas repris le texte du scrolling car trop long a taper de plus a cette epoque " +
        "le texte ne servait qu a illustrer les capacites techniques du scrolling la par exemple je fais du remplissage pour que vous " +
        "puissiez apprecier la musique qui d apres l auteur certaienement serge alias longshot est du jeu rampage "+
        "en fait c est rampart ce qui est pareil que rampage mais avec des chevaliers a la place des dinosaures bref "+
        "je vais m attaquer a un peu plus technique comme retroremake la prochaine fois j en profite pour remercier google " +
        "de m avoir supprime mon compte developpeur pour des raisons obscures  ce jour     c est pas demain que je vais faire " +
        "fortune avec mes applis android    pas grave l espoir fait vivre             ")

;Create Window
OpenWindow(0, 0, 0, #SCREEN_CX, 545, "Logon Sytem démon N°2 1988 JmG@2017", #PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(0), 0, 0, #SCREEN_CX, #SCREEN_CY)
SetFrameRate(60)
;Create Window End

;Create Logo
SpriteLogo_1 = CatchSprite(#PB_Any,?Sprite)
;Create Logo

;Create Scroller
Dim spriteFonts.l(65)
fnt=CatchImage(#PB_Any, ? Font)
For i = 0 To 65
  yCharPos = i / 10 *32
  xCharPos = i % 10 *32
  tempImage_Scroll = GrabImage(fnt , #PB_Any, xCharPos, yCharPos, 32, 32)
  spriteFonts(i) = CreateSprite(#PB_Any, 32, 32)
  StartDrawing(SpriteOutput(spriteFonts(i)))
  DrawAlphaImage(ImageID(tempImage_Scroll), 0, 0)
  StopDrawing()
Next
FreeImage(fnt)
FreeImage(tempImage_Scroll)
VirtualLength_Scroll.l = Len(Text)*32
;Create Scroller End

;Create MP3 Sound
CreateFile(1,GetTemporaryDirectory()+"Sound.mp3")
WriteData(1, ?chiptune, ?endchiptune-?chiptune)
CloseFile(1)
LoadMovie(0, GetTemporaryDirectory()+"Sound.mp3")
PlayMovie(0,0)
;Create MP3 Sound End

Repeat
  ExamineKeyboard()
  While WindowEvent() : Wend
 
  ;Loop MP3 Aound
  If MovieStatus(0)=0
    PlayMovie(0,0)
    Repeat
    Until MovieStatus(0)>1
  EndIf
  ;Loop MP3 Sound End
   
  ClearScreen(RGB(0,0,0))
 
  ;Display Logo
  DisplaySprite (SpriteLogo_1, 0, 0)
  ;Display Logo End
 
  ;Display Scrolltext
  Scroll_x=Scroll_x-10
  If Scroll_x<-VirtualLength_Scroll
    Scroll_x=#SCREEN_CX+64
  EndIf
  For i = 1 To Len(Text)
    LetterID_Scroll.b = Asc(Mid(Text, i, 1))-32
    XPositionScroll.w = Scroll_x + ((i-1)*32)
    If XPositionScroll>#SCREEN_CX+64
      Break
    EndIf
    If XPositionScroll> -32
      DisplaySprite(spriteFonts(LetterID_Scroll),XPositionScroll,485)
    EndIf
  Next i
  ;Display Scrolltext End
       
  FlipBuffers()
       
Until Event = #PB_Event_CloseWindow Or KeyboardPushed(#PB_Key_Escape)
;Delete Temp MP3 Sound
DeleteFile(GetTemporaryDirectory()+"sound.mp3")
;Delete Temp MP3 Sound End

DataSection
  sprite:
  IncludeBinary "scr1.png"
  endsprite:
  chiptune:
  IncludeBinary "chiptune1.mp3"
  endchiptune:
  Font:
  IncludeBinary "fnt.bmp"
  endfont:
EndDataSection
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: padman on February 18, 2018
... and here's my attempt. With original font, scrolltext and AY music. Couldn't be bothered to include the DLL in the exe and run it from memory though. If you want a single exe, this could also be added easily. Would love to see some more CPC remakes!  :cheers:

Code: [Select]
;##########################################################################################
;# Original CPC remake by JmG / This version by Padman (02/2018)                          #
;# Font ripped by MIC of CPCCRACKERS                                                      #
;# "St_sound.dll" by Leonard / Oxygene                                                    #                                       
;# Scroller code initially by Shockwave / vain!                                           #
;########################################################################################## 


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

OpenLibrary(0, "st_sound.dll")
IncludeFile "scroll.pbi"                             

xres  = 768           
yres  = 540         
sco   = 0
tptr  = 1

;#### Init stuff
InitSprite()                     
InitKeyboard()                 

;#### Open the window
OpenWindow(1,0,0,xres,yres,"CPC Demo Remake",#PB_Window_ScreenCentered  | #PB_Window_BorderLess )
OpenWindowedScreen(WindowID(1),0,0,xres,yres,0,0,0)

;#### Catch the pic sprite and zoom it
CatchSprite(0,?pic)
ZoomSprite(0,SpriteWidth(0)*2,SpriteHeight(0)*2)

;#### Catch the font pic sprite
CatchSprite(1,?font)

;#### Init and start the music replay
*YM_Start = GetFunction(0, "_STS_Play@4")
*YM_Start_Mem= GetFunction(0,"_STS_Play_Mem@8")
*YM_Stop = GetFunction(0, "_STS_Stop@0")

CallFunctionFast(*YM_Start_Mem,?Ym,?YmEnd-?YM)
 
Repeat

WaitWindowEvent(1)
 
ClearScreen($0)                                       

;#### This displays the pic

DisplaySprite(0,0,0)

; #### This draws the scroller
 
cco = 0

  For cc = 0 To 40
    letter   = Asc(UCase(Mid(t.s, tptr+cc, 1)))-32
 
    yCharPos = letter / 20
    xCharPos = letter % 20

   ClipSprite(1, xCharPos*16, yCharPos*14, 16,14)
   
    ZoomSprite(1,SpriteWidth(1)*2,SpriteHeight(1)*2)
     DisplayTransparentSprite(1, (sco+cco),485)
 
   
    cco = cco + 32
  Next
 
     
  sco = sco -3
   
  If sco < -32
    tptr = tptr + 1
    sco = sco + 32
  EndIf
     
  If tptr > Len(t.s)-32
    tptr = 0
  EndIf

ExamineKeyboard()

FlipBuffers()                                       

Until KeyboardPushed (#PB_Key_Escape)               

;#### If [ESC] was pressed stop the music and close the DLL
 
  CallFunctionFast(*YM_Stop)
  CloseLibrary(0)

End

DataSection
  font:
  IncludeBinary "font.bmp"
  pic:
  IncludeBinary "screen.bmp"
  Ym:
  IncludeBinary "rampart.ym"
  YmEnd:

EndDataSection
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: ~Ar-S~ on March 03, 2018
Thanks padman. It working with 5.62 x86 (but invalid access mem to the callFunctionFast with x64)  :clap:
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: padman on March 03, 2018
You are right, I should have mentioned that it only works when compiled with PB x86. The DLL is 32 bit and you can't call it from a x64 application. But I guess 32 bit is enough for a CPC remake anyways... ;)
Title: Re: [Retroremake] Amstrad CPC for fun
Post by: KrazyK on March 04, 2018
Nice work padman.  And here's the memory loaded dll version for a single exe file.  Added and changed a few lines to keep the window on top, hide the cursor and stop the crashing when clicking outside the window.  Still only x86 as Padmans says as there's no x64 dll.



Title: Re: [Retroremake] Amstrad CPC for fun
Post by: padman on March 04, 2018
Nice work mate  :goodpost: Didn't know WaitWindowEvent() could cause a crash as it doesn't crash here no matter how often I click outside the window. But as it obviously can K+ for the fix.