Page 1 of 1

DemoCoding - OldSkool Floor Casting Effect

Posted: Sat Jan 19, 2008 11:51 pm
by va!n
Maybe some of you here may know me from older days... Here is a small unoptimized oldskool demo effect like seen in many intros, demos and cracktros end of 80th and beginning the 90th on amiga.... So have fun with the source... best regards

Code: Select all

; --------------------------------------------------------------
;
; OldSkool DemoEffect:  Floor Casting
;
; Converted by: Thorsten Will aka Mr.Vain/Secretly!
; Thanks a lot to "rain storm" for his original source! *thumbs up*
;
; --------------------------------------------------------------

resX = 640
resY = 480
xres = 320
yres = 240

InitSprite() 
InitKeyboard()
OpenScreen( resX, resY, 32, "Floor Casting DemoEffect" )

Repeat
    ExamineKeyboard()
    StartDrawing(ScreenOutput())
  
    camY.f = camY  + 2                           ; change for speed
    camX.f = xres * Sin( camY * 3.14159 / 180 )
    b.f = 0
    For y = 0 To resY -1
        w.f = -yres / y
        v.f = (  resX * w - camY )
        u.f = ( -xres * w + camX )
        For x = 0 To resX -1
            c = ( Int(u) ! Int(v) ) & 255 
            Plot( x, y, RGB( c, c, c ))
            u = u + w
        Next
        b = b + resX
    Next

    StopDrawing()
    FlipBuffers()
Until KeyboardPushed( #PB_Key_Escape )
End

Posted: Sat Jan 19, 2008 11:53 pm
by Hroudtwolf
Hi,

Nice to see here cool demoeffects.
Thanks you for sharing.

Best regards

Wolf

Posted: Sun Jan 20, 2008 1:09 am
by rsts
An ocean of tile :)

Posted: Sun Jan 20, 2008 1:49 am
by va!n
thanks for the feedback... here is a better (fixed) and still unoptimized version with depth look...

Code: Select all

; --------------------------------------------------------------
;
; OldSkool DemoEffect:  Floor Casting
;
; Converted by: Thorsten Will aka Mr.Vain/Secretly!
; Thanks a lot to "rain storm" for his original source! *thumbs up*
;
; --------------------------------------------------------------

resX = 640
resY = 480
xres = 320
yres = 240

InitSprite() 
InitKeyboard()
OpenScreen( resX, resY, 32, "Floor Casting DemoEffect" )

Repeat
    ExamineKeyboard()
    StartDrawing(ScreenOutput())
  
    camY.f = camY  + 2                           ; change for speed
    camX.f = xres * Sin( camY * 3.14159 / 180 )
    b.f = 0
    For y = 0 To resY -1
        w.f = -yres / y
        v.f = (  resX * w - camY )
        u.f = ( -xres * w + camX )
        For x = 0 To resX -1
            t =  ((Int(u) ! Int(v) ) & 255 )
            c = Int((t / resY) * y)
            Plot( x, y, RGB( c, c, c ))
            u = u + w
        Next
        b = b + resX
    Next

    StopDrawing()
    FlipBuffers()
Until KeyboardPushed( #PB_Key_Escape )
End

Posted: Mon Jan 21, 2008 12:07 pm
by Blue
Amazing what a few heavy-loaded programming strings will do...

Thanks a million.

( "Doctor Will, I'm feeling a bit dizzy. The floor seems to be moving right before my very eyes. Is that normal?" )

Posted: Tue Jan 22, 2008 12:42 am
by va!n
Thanks for your nice feedback guys!
( "Doctor Will, I'm feeling a bit dizzy. The floor seems to be moving right before my very eyes. Is that normal?" )
("Oha... thats not normal... you can solve the problem by moving your head left/right to the movement speed on the screen *grin*")