Eventually this will be an intro for Surprise productions, at the moment though it's just a single effect (chess field).
'
' New S!P Intro
' By Shockwave!
'
' Huge thanks to Rbraz I have used Tinyptc Ext and also his image code!
' ---------------------------------------------------------------------
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SETUP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#INCLUDE "TINYPTC_EXT.BI"
#INCLUDE "WINDOWS.BI"
OPTION STATIC
OPTION EXPLICIT
CONST XRES = 800
CONST YRES = 600
DIM SHARED AS INTEGER HALFX = XRES / 2
DIM SHARED AS INTEGER HALFY = YRES / 2
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' VARIABLE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIM SHARED AS UINTEGER BUFFER ( XRES * YRES )
DIM SHARED AS INTEGER CHESS_RES = 20
DIM SHARED AS DOUBLE CXP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE CYP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE CZP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE BOARDOFFS
DIM SHARED AS INTEGER CLICKS,CLICK
CLICKS=0
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SUBROUTINE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE SUB CHESS_SET ()
DECLARE SUB CHESS_DRAW()
DECLARE SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' OPEN SCREEN;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_ALLOWCLOSE(0)
PTC_SETDIALOG(0,"RUN IN FULLSCREEN MODE?",0,0)
IF (PTC_OPEN("((S!P))",XRES,YRES)=0) THEN
END-1
END IF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' PRECALCULATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CHESS_SET()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MAIN LOOP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)
CHESS_DRAW()
PTC_UPDATE@BUFFER(0)
ERASE BUFFER
WEND
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' CLEAN UP AND EXIT;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_CLOSE
END
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SET UP CHESS BOARD;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_SET()
DIM AS INTEGER Z , Y
DIM AS DOUBLE STRTZ , STRTY , CADD , AZP , AYP
CADD = ( 14000 / CHESS_RES )
STRTZ = 1
STRTY = -7000
AZP = STRTZ
AYP = STRTY
FOR Z=1 TO CHESS_RES
AYP=STRTY
FOR Y=1 TO CHESS_RES
CXP ( Y , Z ) = 2000
CYP ( Y , Z ) = AYP
CZP ( Y , Z ) = AZP
AYP = AYP + CADD
NEXT
AZP = AZP + 1
NEXT
END SUB
SUB CHESS_DRAW()
DIM AS INTEGER Z , Y
DIM AS INTEGER TX , TY
DIM AS INTEGER TX1 , TY1
DIM AS INTEGER TX2 , TY2
DIM AS INTEGER TX3 , TY3
DIM AS INTEGER TX4 , TY4
DIM AS INTEGER CLICKED,CVLC
CLICKED=CLICKS
CVLC=255-(BOARDOFFS*10)
FOR Z=1 TO CHESS_RES -1
CLICK=CLICKED
CLICKED=CLICKED+1
IF CLICKED>1 THEN CLICKED=0
FOR Y=1 TO CHESS_RES -1
TX1 = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , RGB(CVLC/4,CVLC/3,CVLC) )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , RGB(CVLC/4,CVLC/3,CVLC) )
END IF
CLICK=CLICK+1
IF CLICK>1 THEN CLICK=0
'IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
' END IF
NEXT
CVLC=CVLC-13
NEXT
FOR Z=1 TO CHESS_RES
FOR Y=1 TO CHESS_RES
TX = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
END IF
NEXT
NEXT
BOARDOFFS=BOARDOFFS+.1
IF BOARDOFFS>1 THEN
BOARDOFFS=BOARDOFFS-1
CLICKS=CLICKS-1
IF CLICKS<0 THEN CLICKS=1
END IF
END SUB
SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'-------------------------------------------------------------------------
' FLAT TRIANGLE RENDERER WITH ASSEMBLY LANGUAGE RASTERISING BY SHOCKWAVE ^ DBF ^ S!P 2006.
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
' WE NEED TO SORT THESE POINTS INTO ORDER FROM TOP TO BOTTOM, AN EXCHANGE SORT IS OK.
' AS WE ONLY HAVE GOT 3 POINTS TO ARRANGE.
'-------------------------------------------------------------------------
DIM AS INTEGER TEMPX,TEMPY,LO,LI
DIM AS INTEGER PX(3)
DIM AS INTEGER PY(3)
DIM TFLAG AS INTEGER
dim pp as uinteger PTR
DIM AS INTEGER IL1,IL2,SLICE
TFLAG=0
PX(1)= X1
PX(2)= X2
PX(3)= X3
PY(1)= Y1
PY(2)= Y2
PY(3)= Y3
FOR LO = 1 TO 2
FOR LI =1 TO 2
IF PY(LI+1) <= PY(LI) THEN
TEMPX = PX(LI) : TEMPY = PY(LI)
PX(LI) = PX(LI+1)
PY(LI) = PY(LI+1)
PX(LI+1) = TEMPX
PY(LI+1) = TEMPY
END IF
NEXT LI
NEXT LO
' BOOT OUT INVISIBLE TRIANGLES!
IF PX(1)<0 AND PX(2)<0 AND PX(3)< 0 THEN TFLAG=1
IF PX(1)>XRES AND PX(2)>XRES AND PX(3)>XRES THEN TFLAG=1
IF PY(1)>YRES AND PY(2)>YRES AND PY(3)>YRES THEN TFLAG=1
DIM AS DOUBLE XP1,XP2:' SCREEN POSITIONS.
DIM AS DOUBLE XI1,XI2:' INTERPOLATIONS.
'***
'*** REGULAR TRIANGLE (Y1<Y2 Y2<Y3)
'***
IF PY(1)<PY(2) AND PY(2)<PY(3) or (PY(2) = PY(3)) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(1)
XI1 = (PX(1)-PX(2)) / (PY(2) - PY(1))
XI2 = (PX(1)-PX(3)) / (PY(3) - PY(1))
FOR LO = PY(1) TO PY(2)-1
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
XI1 = (PX(2)-PX(3)) / (PY(3) - PY(2))
XP1 = PX(2)
FOR LO = PY(2) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
'***
'*** FLAT TOPPED TRIANGLE Y1=Y2
'***
IF TFLAG=0 AND PY(1) = PY(2) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(2)
XI1 = (PX(1)-PX(3)) / (PY(3) - PY(1))
XI2 = (PX(2)-PX(3)) / (PY(3) - PY(2))
FOR LO = PY(1) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
END SUB
Hi shocky
Nice effect :) , but is not that chessfield scrolling that same as that one in IROSP4.bas except that it is vertically here ?
All chessfields look similar mate :) This code is new though.
All it takes is a little magic dust and it can look quite different...
Exe attached :)
Quote from: Shockwave on July 07, 2007
All it takes is a little magic dust and it can look quite different...
Exe attached :)
Yep, little magic dust makes all difference ;D
very funky sw i could look at it for hours :kewl:
... indeed ... looks very promising :)
Quote from: Shockwave on July 07, 2007
All it takes is a little magic dust and it can look quite different...
Exe attached :)
yes , it is deffernce now , waiting the final demo, good luck . :)
Ooh :D Lots of replies! Thanks chaps!
If I get chance I'll work on it more today. I might post a few versions of this as it progresses. (it will change a lot).
:clap:
Tried something else, it's only hacked in at the moment (this can and will be heavily optimised).
Just hacked in quick so I could see if it worked.
'
' New S!P Intro
' By Shockwave!
'
' Huge thanks to Rbraz I have used Tinyptc Ext and also his image code!
' ---------------------------------------------------------------------
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SETUP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#INCLUDE "TINYPTC_EXT.BI"
#INCLUDE "WINDOWS.BI"
OPTION STATIC
OPTION EXPLICIT
CONST XRES = 800
CONST YRES = 600
DIM SHARED AS INTEGER HALFX = XRES / 2
DIM SHARED AS INTEGER HALFY = YRES / 2
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' VARIABLE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIM SHARED AS UINTEGER BUFFER ( XRES * YRES )
DIM SHARED AS INTEGER CHESS_RES = 20
DIM SHARED AS DOUBLE CXP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE CYP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE CZP ( CHESS_RES , CHESS_RES )
DIM SHARED AS DOUBLE BOARDOFFS
DIM SHARED AS INTEGER CLICKS,CLICK
CLICKS=0
DIM SHARED AS INTEGER BPL ( 512,YRES*4 )
dim shared COPOFF AS INTEGER
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SUBROUTINE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE SUB SETBOARDPALETTE()
DECLARE SUB CHESS_SET ()
DECLARE SUB CHESS_DRAW()
DECLARE SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' OPEN SCREEN;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_ALLOWCLOSE(0)
PTC_SETDIALOG(0,"RUN IN FULLSCREEN MODE?",0,0)
IF (PTC_OPEN("((S!P))",XRES,YRES)=0) THEN
END-1
END IF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' PRECALCULATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SETBOARDPALETTE()
CHESS_SET()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MAIN LOOP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)
COPOFF=(HALFY*2)+1+((HALFY*2)*SIN(TIMER))
CHESS_SET ()
CHESS_DRAW()
PTC_UPDATE@BUFFER(0)
ERASE BUFFER
WEND
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' CLEAN UP AND EXIT;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_CLOSE
END
SUB SETBOARDPALETTE()
DIM AS INTEGER Z,Y
DIM AS DOUBLE X
X=0
FOR Z=0 TO 512
FOR Y=0 TO YRES*4
BPL (Z,Y) = RGB(int(X+1+((X*SIN((Y+10)/180)))),int(X+1+((X*SIN((Y+10)/170)))),int(X+1+((X*SIN((Y+30)/170)))))
NEXT
IF X<125 THEN X=X+(Z/700)
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SET UP CHESS BOARD;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_SET()
dim cunt as integer
CUNT = 200*SIN(TIMER*3)
DIM AS INTEGER Z , Y
DIM AS DOUBLE STRTZ , STRTY , CADD , AZP , AYP
CADD = ( 14000 / CHESS_RES )
STRTZ = .1
STRTY = -6500
AZP = STRTZ
AYP = STRTY
FOR Z=1 TO CHESS_RES
AYP=STRTY
FOR Y=1 TO CHESS_RES
CXP ( Y , Z ) = 800+CUNT*sin((y+timer)/3)
CYP ( Y , Z ) = AYP
CZP ( Y , Z ) = AZP
AYP = AYP + CADD
NEXT
AZP = AZP + 1
NEXT
END SUB
SUB CHESS_DRAW()
DIM AS INTEGER Z , Y
DIM AS INTEGER TX , TY
DIM AS INTEGER TX1 , TY1
DIM AS INTEGER TX2 , TY2
DIM AS INTEGER TX3 , TY3
DIM AS INTEGER TX4 , TY4
DIM AS INTEGER CLICKED,CVLC
CLICKED=CLICKS
CVLC=(250-(BOARDOFFS*10))
FOR Z=1 TO CHESS_RES -1
CLICK=CLICKED
CLICKED=CLICKED+1
IF CLICKED>1 THEN CLICKED=0
FOR Y=1 TO CHESS_RES -1
TX1 = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
TX1 = ( -CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( -CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( -CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( -CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
CLICK=CLICK+1
IF CLICK>1 THEN CLICK=0
'IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
' END IF
NEXT
CVLC=CVLC-13
NEXT
FOR Z=1 TO CHESS_RES
FOR Y=1 TO CHESS_RES
TX = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
END IF
NEXT
NEXT
BOARDOFFS=BOARDOFFS+.1
IF BOARDOFFS>1 THEN
BOARDOFFS=BOARDOFFS-1
CLICKS=CLICKS-1
IF CLICKS<0 THEN CLICKS=1
END IF
END SUB
SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'-------------------------------------------------------------------------
' FLAT TRIANGLE RENDERER WITH ASSEMBLY LANGUAGE RASTERISING BY SHOCKWAVE ^ DBF ^ S!P 2006.
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
' WE NEED TO SORT THESE POINTS INTO ORDER FROM TOP TO BOTTOM, AN EXCHANGE SORT IS OK.
' AS WE ONLY HAVE GOT 3 POINTS TO ARRANGE.
'-------------------------------------------------------------------------
DIM AS INTEGER TEMPX,TEMPY,LO,LI
DIM AS INTEGER PX(3)
DIM AS INTEGER PY(3)
DIM TFLAG AS INTEGER
dim pp as uinteger PTR
DIM AS INTEGER IL1,IL2,SLICE,TTC
TFLAG=0
PX(1)= X1
PX(2)= X2
PX(3)= X3
PY(1)= Y1
PY(2)= Y2
PY(3)= Y3
FOR LO = 1 TO 2
FOR LI =1 TO 2
IF PY(LI+1) <= PY(LI) THEN
TEMPX = PX(LI) : TEMPY = PY(LI)
PX(LI) = PX(LI+1)
PY(LI) = PY(LI+1)
PX(LI+1) = TEMPX
PY(LI+1) = TEMPY
END IF
NEXT LI
NEXT LO
' BOOT OUT INVISIBLE TRIANGLES!
IF PX(1)<0 AND PX(2)<0 AND PX(3)< 0 THEN TFLAG=1
IF PX(1)>XRES AND PX(2)>XRES AND PX(3)>XRES THEN TFLAG=1
IF PY(1)>YRES AND PY(2)>YRES AND PY(3)>YRES THEN TFLAG=1
DIM AS DOUBLE XP1,XP2:' SCREEN POSITIONS.
DIM AS DOUBLE XI1,XI2:' INTERPOLATIONS.
'***
'*** REGULAR TRIANGLE (Y1<Y2 Y2<Y3)
'***
IF PY(1)<PY(2) AND PY(2)<PY(3) or (PY(2) = PY(3)) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(1)
XI1 = (PX(1)-PX(2)) / (PY(2) - PY(1))
XI2 = (PX(1)-PX(3)) / (PY(3) - PY(1))
FOR LO = PY(1) TO PY(2)-1
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
XI1 = (PX(2)-PX(3)) / (PY(3) - PY(2))
XP1 = PX(2)
FOR LO = PY(2) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
'***
'*** FLAT TOPPED TRIANGLE Y1=Y2
'***
IF TFLAG=0 AND PY(1) = PY(2) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(2)
XI1 = (PX(1)-PX(3)) / (PY(3) - PY(1))
XI2 = (PX(2)-PX(3)) / (PY(3) - PY(2))
FOR LO = PY(1) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
END SUB
Other ideas are coming to mind for this intro now and I think I have decided on some kind of vertical scroll text.
i have tested the attached exe and it looks nice... nice work! ;)
Thats cool, like the light effect:)
Holy crap shockwave! that sure is some cool shit!
I was mesmerized! a cool vertical scroller in the middle would be the dogs nads!
Wicked wicked code again shocky! Cheers matey!
Drew
ps sorry I haven't posted more - real life is a little wild at the mo - don't seem to get much time to code!
No worries Drew :) Nice to know you are still fit and well.
The scroll will utilise the space between the two chess fields, probably I'll texture the scroller and use some sort of linear interpolation to squeeze the scroll in and out.
I will post more versions as they materialise just in case it interests anyone who is looking to code an intro.
for sure it does m8 ... thanks (once again) for sharing all your stuff :)
Nice way to get "ambience"!
Well I finished working on this for tonight and the scroller is now half implimented.
Some thoughts of what is going on here. I had an idea to have a vertical scroll, first steps are to create a kind of image buffer that the scroll can be drawn on, then this image buffer can be drawn to the screen in an interesting way.
Main overhead in this technique would actually have been copying the whole texture and moving it inside the buffer.
Effectively the best way to do this is by simulating a "block move" ie. copying all the data at once, instead we just have an offset variable that we change so we start at a different point in the bank each frame (remember to define enough extra space to have one letter offscreen :-P)
Result, well, the intro is now starting to slow down and needs optimisation.
However the engine to do the scroll is implimented (with a simple texture for now).
Optimisation will take place tomorrow, it's the chessfield that needs speeding up :-) I believe that it will be easy to squeeze about another 35 % out of this program and maybe it will finish up in 800 X 600.
Enough of that anyway, here's the source and exe is attached.
'
' New S!P Intro
' By Shockwave!
'
' Huge thanks to Rbraz I have used Tinyptc Ext and also his image code!
' ---------------------------------------------------------------------
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SETUP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#INCLUDE "TINYPTC_EXT.BI"
#INCLUDE "WINDOWS.BI"
OPTION STATIC
OPTION EXPLICIT
CONST XRES = 640
CONST YRES = 480
DIM SHARED AS INTEGER HALFX = XRES / 2
DIM SHARED AS INTEGER HALFY = YRES / 2
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' VARIABLE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIM SHARED AS UINTEGER BUFFER ( XRES * YRES ):' SCREEN BUFFER
DIM SHARED AS INTEGER CHESS_RES = 20:' CHESSFIELD DENSITY
DIM SHARED AS DOUBLE CXP ( CHESS_RES , CHESS_RES ):' CHESSFIELD X
DIM SHARED AS DOUBLE CYP ( CHESS_RES , CHESS_RES ):' CHESSFIELD Y
DIM SHARED AS DOUBLE CZP ( CHESS_RES , CHESS_RES ):' CHESSFIELD Z
DIM SHARED AS DOUBLE BOARDOFFS:' CHESSFIELD SCROLL VAR
DIM SHARED AS INTEGER CLICKS,CLICK:' USED TO CREATE PATTERN OFFSET
CLICKS=0
DIM SHARED AS INTEGER BPL ( 512,YRES*4 ):' PALETTE (COPPERLIST)
DIM SHARED AS DOUBLE TIMER_SNAPSHOT:' TO STORE A SNAPSHOT OF THE TIMER
DIM SHARED AS DOUBLE GADD:' USED TO MAKE SINE VALUES ETC
DIM SHARED AS INTEGER SCROLL (32*(YRES+32)):' SCROLL BUFFER (HOLDS SCROLLTEXT IMAGE)
DIM SHARED AS INTEGER SCROLLPOS=0:' SCROLL OFFSET VARIABLE
dim shared AS INTEGER COPOFF :' COPPERLIST SCROLL OFFSET
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SUBROUTINE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE SUB GENERATE_TEXTURES():' TO CREATE TEXTURE MAPS
DECLARE SUB SETBOARDPALETTE():' TO CREATE COPPERLIST FOR BOARD
DECLARE SUB CHESS_SET ():' TO CREATE CHESSBOARD 3D OBJECT
DECLARE SUB CHESS_DRAW():' TO DRAW CHESSBOARD
DECLARE SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
DECLARE SUB DRAWSCROLL():' TO DRAW AND UPDATE THE SCROLLER
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' OPEN SCREEN;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_ALLOWCLOSE(0)
PTC_SETDIALOG(0,"RUN IN FULLSCREEN MODE?",0,0)
IF (PTC_OPEN("((S!P))",XRES,YRES)=0) THEN
END-1
END IF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' PRECALCULATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GENERATE_TEXTURES()
SETBOARDPALETTE()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MAIN LOOP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)
GADD=GADD+1
TIMER_SNAPSHOT=TIMER
COPOFF=(HALFY*2)+1+((HALFY*2)*SIN(TIMER_SNAPSHOT))
CHESS_SET ()
CHESS_DRAW()
DRAWSCROLL()
PTC_UPDATE@BUFFER(0)
ERASE BUFFER
WEND
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' CLEAN UP AND EXIT;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_CLOSE
END
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' THIS SUBROUTINE DRAWS THE SCROLLTEXT TO THE SCREEN LINEAR INTERPOLATED BETWEEN
' A SET OF POINTS DRAWN DOWN THE SCREEN TO "STRETCH" THE LETTERS.
' ALSO OF NOTE IS THE FACT THAT IT SCROLLS WITHOUT ACTUALLY SHIFTING ANY OF THE
' VALUES IN THE SCROLL BUFFER, IT SIMPLY USES AN OFFSET VARIABLE.
' THIS IS FAIRLY OPTIMISED, MORE CAN BE DONE.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB DRAWSCROLL()
dim as integer CUNT,CUNT2
CUNT = 40*SIN(TIMER_SNAPSHOT*3)
CUNT2= 30*SIN(TIMER_SNAPSHOT*2)
DIM AS INTEGER Y,X,x1,x2
DIM AS DOUBLE SV
DIM AS DOUBLE INTER,STRT
FOR Y=0 TO YRES-1
SV=((CUNT*COS((Y+TIMER_SNAPSHOT+GADD)/27))+(CUNT2*SIN((Y-GADD)/21)))
X2=(HALFX+SV)+70:' GENERATE POINT B
X1=(HALFX-SV)-70:' GENERATE POINT A
STRT = SCROLLPOS*32:' PUT STRT AT CORRECT POINT IN SCROLL IMAGE
INTER = 31 / (x2-x1):' WORK OUT INTERPOLATION VALUE
'-----------------------------------------------------------------------
' DRAW ONE HORIZONTAL LINE OF THE SCROLL
'-----------------------------------------------------------------------
FOR X=X1 TO X2
BUFFER(X+(Y*XRES)) = SCROLL(STRT)
STRT=STRT+INTER
NEXT
'-----------------------------------------------------------------------
' ADVANCE SCROLL POINTER, IF AT END OF BANK - 1 LETTER, RESET IT :-p
'-----------------------------------------------------------------------
SCROLLPOS=SCROLLPOS+1
IF SCROLLPOS>=YRES THEN SCROLLPOS=SCROLLPOS-YRES
NEXT
'-----------------------------------------------------------------------
' SCROLL WITHOUT COPYING ANY DATA :-P
'-----------------------------------------------------------------------
SCROLLPOS=SCROLLPOS+2
IF SCROLLPOS>=YRES THEN SCROLLPOS=SCROLLPOS-YRES
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' JUST MAKE A SIMPLE TEXTURE MAP AND STORE IT IN THE SCROLL BUFFER, LATER WE WILL
' USE THIS TO MAKE A NICER TEXTURE MAP TO COLOUR OUR SCROLL.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB GENERATE_TEXTURES()
DIM AS INTEGER X,Y
FOR Y=0 TO YRES+31
FOR X=0 TO 32
SCROLL(X+(Y*32)) = RGB((X*4) XOR (Y*4) , (X*4) XOR (Y*4),X XOR Y)
NEXT
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' HERE WE CREATE THE COPPERLIST FOR THE CHESSBOARD.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB SETBOARDPALETTE()
DIM AS INTEGER Z,Y
DIM AS DOUBLE X
X=0
FOR Z=0 TO 512
FOR Y=0 TO YRES*4
BPL (Z,Y) = RGB(int(X+1+((X*SIN((Y+10)/180)))),int(X+1+((X*SIN((Y+10)/170)))),int(X+1+((X*SIN((Y+30)/170)))))
NEXT
IF X<125 THEN X=X+(Z/700)
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SET UP CHESS BOARD;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_SET()
dim cunt as integer
CUNT = 400*SIN(TIMER_SNAPSHOT*3)
DIM AS INTEGER Z , Y
DIM AS DOUBLE STRTZ , STRTY , CADD , AZP , AYP
CADD = ( 14000 / CHESS_RES )
STRTZ = .1
STRTY = -6500
AZP = STRTZ
AYP = STRTY
FOR Z=1 TO CHESS_RES
AYP=STRTY
FOR Y=1 TO CHESS_RES
CXP ( Y , Z ) = 1000+CUNT*sin((y+TIMER_SNAPSHOT)/3)
CYP ( Y , Z ) = AYP
CZP ( Y , Z ) = AZP
AYP = AYP + CADD
NEXT
AZP = AZP + 1
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' DRAW CHESS BOARD.. THIS IS THE SLOW BIT!!!! NEEDS OPTIMISING.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_DRAW()
DIM AS INTEGER Z , Y
DIM AS INTEGER TX , TY
DIM AS INTEGER TX1 , TY1
DIM AS INTEGER TX2 , TY2
DIM AS INTEGER TX3 , TY3
DIM AS INTEGER TX4 , TY4
DIM AS INTEGER CLICKED,CVLC
CLICKED=CLICKS
CVLC=(250-(BOARDOFFS*10))
FOR Z=1 TO CHESS_RES -1
CLICK=CLICKED
CLICKED=CLICKED+1
IF CLICKED>1 THEN CLICKED=0
FOR Y=1 TO CHESS_RES -1
TX1 = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
TX1 = ( -CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( -CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( -CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( -CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
CLICK=CLICK+1
IF CLICK>1 THEN CLICK=0
'IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
' END IF
NEXT
CVLC=CVLC-13
NEXT
FOR Z=1 TO CHESS_RES
FOR Y=1 TO CHESS_RES
TX = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
IF TX>0 AND TX<XRES AND TY>0 AND TY<YRES THEN
' BUFFER ( TX + ( TY*XRES ) ) = &HFFFFFF
END IF
NEXT
NEXT
BOARDOFFS=BOARDOFFS+.1
IF BOARDOFFS>1 THEN
BOARDOFFS=BOARDOFFS-1
CLICKS=CLICKS-1
IF CLICKS<0 THEN CLICKS=1
END IF
END SUB
SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'-------------------------------------------------------------------------
' FLAT TRIANGLE RENDERER WITH ASSEMBLY LANGUAGE RASTERISING BY SHOCKWAVE ^ DBF ^ S!P 2006.
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
' WE NEED TO SORT THESE POINTS INTO ORDER FROM TOP TO BOTTOM, AN EXCHANGE SORT IS OK.
' AS WE ONLY HAVE GOT 3 POINTS TO ARRANGE.
'-------------------------------------------------------------------------
DIM AS INTEGER TEMPX,TEMPY,LO,LI
DIM AS INTEGER PX(3)
DIM AS INTEGER PY(3)
DIM TFLAG AS INTEGER
dim pp as uinteger PTR
DIM AS INTEGER IL1,IL2,SLICE,TTC
TFLAG=0
PX(1)= X1
PX(2)= X2
PX(3)= X3
PY(1)= Y1
PY(2)= Y2
PY(3)= Y3
FOR LO = 1 TO 2
FOR LI =1 TO 2
IF PY(LI+1) <= PY(LI) THEN
TEMPX = PX(LI) : TEMPY = PY(LI)
PX(LI) = PX(LI+1)
PY(LI) = PY(LI+1)
PX(LI+1) = TEMPX
PY(LI+1) = TEMPY
END IF
NEXT LI
NEXT LO
' BOOT OUT INVISIBLE TRIANGLES!
IF PX(1)<0 AND PX(2)<0 AND PX(3)< 0 THEN TFLAG=1
IF PX(1)>XRES AND PX(2)>XRES AND PX(3)>XRES THEN TFLAG=1
IF PY(1)>YRES AND PY(2)>YRES AND PY(3)>YRES THEN TFLAG=1
DIM AS DOUBLE XP1,XP2:' SCREEN POSITIONS.
DIM AS DOUBLE XI1,XI2:' INTERPOLATIONS.
'***
'*** REGULAR TRIANGLE (Y1<Y2 Y2<Y3)
'***
IF PY(1)<PY(2) AND PY(2)<PY(3) or (PY(2) = PY(3)) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(1)
XI1 = (PX(1)-PX(2)) / (PY(2) - PY(1))
XI2 = (PX(1)-PX(3)) / (PY(3) - PY(1))
FOR LO = PY(1) TO PY(2)-1
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
XI1 = (PX(2)-PX(3)) / (PY(3) - PY(2))
XP1 = PX(2)
FOR LO = PY(2) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
'***
'*** FLAT TOPPED TRIANGLE Y1=Y2
'***
IF TFLAG=0 AND PY(1) = PY(2) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(2)
XI1 = (PX(1)-PX(3)) / (PY(3) - PY(1))
XI2 = (PX(2)-PX(3)) / (PY(3) - PY(2))
FOR LO = PY(1) TO PY(3)
IF LO>=0 AND LO<YRES THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES THEN IL2=XRES
IF IL1<0 THEN IL1=0
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
END SUB
The chess fx rocks, Shockie. Well done. However I think the wobbler doesn't fit in it.
The chessboard fx is good for it own and the wobbler takes away the focus on it.
Nevertheless, well done ! Looking forward to see the final intro!
:clap: :clap: :clap:
Shi Shocky you thats awesome you could even teach me a thing or two about programming
:bred:
Mmm. Cheers. :)
Mel actually said that the "wobbler" made it difficult to focus on one part of the intro so perhaps I need to think of some other way of making the text.
Perhaps a zooming text typer or summat.
In any case I'll see how the vertical scroll looks before I make a decision about it.
i really like the way you work!
it really helps me to understand the thought process of making a demo peice by peice k+, i would stick with the vertical scroll as i think it will look much better when its finished.
... or some cool typewriter text fx (zoom out / rotate / alpha fade aso.) instead of a scroller ... just a thought :)
nevermind m8 :)
Kinky! I like it. I think if the centre scolly thing is semi-transparent then it won't distract from the other fx.
Jim
Yes, there are things to try out now. I'm in two minds about the scroll / text writer. I will have to try both!
Tonight I will work on optimising it (and making it look more pretty).
Also Stonemonkey sent me a nice code snippet that I think I'll use :D
Funny thing is that I found my mind wandering onto this at times today while I was in work.
I try and shut my eyes sometimes (not when I am driving!) and try to visualise what the effect would look like, anyway I came home full of ideas and after I posted the above I went to sleep on the chair!
Hehe.
Anyway, there is a small update, the wobbler is disabled for now, however I have added something that I was sent by Stonemonkey, it is a nice little routine to add a sort of glow to the chess board, it works by brightening the whole buffer.
Unfortunately it uses MMX instructions so the final version will not have this nice glow if your processor does not supporet mmx.. for now the example doesn't check if your processor supports mmx. Would be interested to see what happens when some cpu without mmx tries to run this program :)
Oh, and most of the changes are under the hood. Chessboard drawing is now about 35% faster as anticipated, speed gain has been used on the brighten routine. Also I tweaked the colours a little bit.
That is beautiful! I preferred the earlier one where intensity of colours varied less but nonthless its great - best chessboards I have seen. Imagine this with the ambient occlusion spheres I did today Shockie! Would be awesome.
Chris
Yeah .. really shiny now. Like it !!!
Even though I probably only spent about 45 minutes on this today, it is dramatically changed now.
I decided that I did not like the resolution, it needed to be in 800 * 600 so that more colours could be displayed.
Of course, this means drawing more pixels so I added margins to the screen, these improve the look and also decrease the amount of pixels I need to draw in the triangle routine (the margins are taken care of with a little bit of asm for speed).
It also needed to do more so it rotates now.
For me, I am almost happy with the background effect, maybe I will tweak colours a bit, but the time to move onto the next part is almost here.
Next I will remove unwanted routines (the wobbler), tidy up the code and check to make sure it is all running as fast as possible, after this is done I need to think about the text routine (I already know I am making a zoom text writer).
So, exe for tonight attached to the zip, source will be posted tomorrow when it is cleaned up and then I will move onto the text writer :)
shockwave you truly are the king of software pixel plotting/design that is stunning mate!!
probably the best i have seen from you yet and trust me it would have to be good to be up there k+
Nice one Nick, looking pretty cool.
Cheers Fryer, your code snippet makes this look nicer than it would be otherwise :)
Honestly Nino, you are too kind but thank you for the Karma :)
I always go through the same process whe I make something, I just thought it would be cool to post the progress as it goes along :)
In my honest opinion (and I mean this) there is only one production I have ever written that I am satisfied with.
THIS ONE (http://www.intro-inferno.com/production.php?id=1912) And it all came together by accident. I have been trying to equal it ever since :)
i love all the stuff you do and i try to learn your code completely so i can understand how stuff works but for me i have never seen a software effect quite match this, and coming from a coding point of view i can appreciate what goes into it :)
Tonight I hope to code a routine that will let me draw a letter anywhere in the screen, which is simple but I want to be able to add a zoom factor, the ultimate aim tonight will be to have a zooming textwriter, this means that the letters must be scaled.
Traditionally it would have been pre-calculated but this time it is going to be done in real time.
I want to be able to provide the text routine with some interpolation value and the routine to automatically center the letter ie. if the letter is scaled to 16 * 16 from an original 32 * 32 image, the letter should be drawn with an offset of;
(32 - 16) / 2 = 8
This is quite important as it will give a better feel to the typer and make the letters easier to center.
Letters will be generated from a "floating source", some invisible point that moves around the screen and they will drift into place, zooming as they go.
The final impression will be of text that zooms into the screen from the distance.
So, probably a few hours work there for me, I will get into my IDE now and post back later :) Hopefully with a working zoom text routine and typer.
Also I will tidy things up a little tonight if there is time.
sounds great ... looking forward to see your stuff m8 :)
Cheers,
SLiPPY
Well, I've finished coding for the evening. I have a nice idea that I think will make this look a lot better, there is going to be a dynamic border effect, the borders will move around the chessfield leaving the centre static.. It's kind of hard to explain it but I can see it in my head.
Anyway, the zoom text was completed successfully and I made a text writer to zoom the letters in from the distance.
I am not sure about the effect I added to the writing, also I am not sure that there is enough oomph in my code to make this resolution possible on most computers, therefore if anyone gets a slow speed and reports it I'll have to drop the res to 640 X 480 :(
Anyhow, here is the current exe :)
Works well here, I really like the scaling but I'm not so sure I like the flicking between the black and white as the letters rotate around each other.
Yep, I'm not sure I like that flicker effect either. I'll probably change it in the end.
what about fading them between black and white so that at the point they cross they're both grey? or always have white on top?
looks pretty cool - really like those oldskool text writer stuff ...
just one idea - think it'll look even cooler, when the zoomed-in character will fade from black to white - the nearer it is, the brighter it'll become ... so it would feel more "3D" ... hope you know what I mean ... :)
Yes, that's a good idea Slippy, I'll add that in.
COuld you scale by x independantly? possibly making it look like they're rotating around each other.
First of all hi all. i have been a member of these forums for a few months but not posted yet. I have been trying to take in the different things, play with code and get a feel for the community etc. I think the community here is great (unlike other sites that seem to have a goal in life to put everybody down) and there is lots of talent here. Hopefully I will start contributing soon!!
Anyway, back to the post at hand, I love the effect of this intro but I have to agree that the black and white effect on the text does ruin it a little bit and maybe the fading idea would be better.
Keep up the excellent work Shockwave. If i can master half of your talent in my freebasic programming I will be a happy man!!
Hi Dragonspirit, it's nice to see you posting :) Feel free to get involved wherever you like, please do and thank you for your kind words about the place and my programs!
Stonemonkey, that's a nice idea about independantly scaline the letters to make them rotate.
I think that in the end I will go for a texture of some kind on the font though.
Just out of interest, the flickering method was made very cheaply, you can see two copies of each letter, I render the shadow and the foreground in the same loop in the same order all the time.
By having some sine and cos offset for the shadow to move it around the flickering is a mathematical side effect of this and the switch occurs as the letters move around. It's something I found by accident some years ago and I thought I'd give it a try to see if it worked. It doesn't suit the intro though so it's been binned!
Looking cool shocky! Bloody Hell your checkerboard effect has come a long way!
Keep it up man looking fantastic!
DrewPee
Cheers drew :) I'm just hoping I haven't :bfuck1: it up now because I added more stuff.
Here's the source code first;
Nb. It won't run as you need the font, however it is here so that you can have a look at it.
And attached to the post is a new exe.
'
' New S!P Intro
' By Shockwave!
'
' Huge thanks to Rbraz I have used Tinyptc Ext and also his image code!
' ---------------------------------------------------------------------
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SETUP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'#DEFINE PTC_WIN
#INCLUDE "a256nickpal.bas"
#INCLUDE "a256nickraw.bas"
#INCLUDE "TINYPTC_EXT.BI"
' #INCLUDE "TINYPTC.BI"
#INCLUDE "WINDOWS.BI"
OPTION STATIC
OPTION EXPLICIT
CONST XRES = 800
CONST YRES = 600
DIM SHARED AS INTEGER HALFX = XRES / 2
DIM SHARED AS INTEGER HALFY = YRES / 2
DIM SHARED AS INTEGER LMARGIN = 80
DIM SHARED AS INTEGER RMARGIN = 80
DIM SHARED AS INTEGER TMARGIN = 80
DIM SHARED AS INTEGER BMARGIN = 80
'-------------------------------------------------------------------------------
' INITIALISE LARGE FONT!!
'-------------------------------------------------------------------------------
'--------------
'--Image size--
'--------------
Const LfimgX = 1800
Const LfimgY = 31
Declare Sub LfDrawImage (byval imxpos as integer,byval imypos as integer,byval SX as integer,byval SY as integer,byval inter as double)
Declare Sub LFLoadDataImage()
'Picture buffer
Dim Shared LFimg_buffer( lfimgx * lfimgy ) as integer
'RGB color palette buffer
Dim Shared LFimg_r(256), LFimg_g(256), LFimg_b(256) as short
LFLoadDataImage()
DECLARE SUB LARGETEXT (BYVAL LTX AS INTEGER , BYVAL LTY AS INTEGER ,BYVAL LTS AS STRING,BYVAL inter AS double)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' VARIABLE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DIM SHARED AS UINTEGER BUFFER ( XRES * YRES ):' SCREEN BUFFER
DIM SHARED AS INTEGER CHESS_RES = 20:' CHESSFIELD DENSITY
DIM SHARED AS DOUBLE CXP ( CHESS_RES , CHESS_RES ):' CHESSFIELD X
DIM SHARED AS DOUBLE CYP ( CHESS_RES , CHESS_RES ):' CHESSFIELD Y
DIM SHARED AS DOUBLE CZP ( CHESS_RES , CHESS_RES ):' CHESSFIELD Z
DIM SHARED AS DOUBLE BOARDOFFS:' CHESSFIELD SCROLL VAR
DIM SHARED AS INTEGER CLICKS,CLICK:' USED TO CREATE PATTERN OFFSET
CLICKS=0
DIM SHARED AS INTEGER BPL ( 512,YRES*4 ):' PALETTE (COPPERLIST)
DIM SHARED AS DOUBLE TIMER_SNAPSHOT:' TO STORE A SNAPSHOT OF THE TIMER
DIM SHARED AS DOUBLE GADD:' USED TO MAKE SINE VALUES ETC
DIM SHARED AS DOUBLE FUCKADD
DIM SHARED AS INTEGER SCROLL (32*(YRES+32)):' SCROLL BUFFER (HOLDS SCROLLTEXT IMAGE)
DIM SHARED AS INTEGER SCROLLPOS=0:' SCROLL OFFSET VARIABLE
dim shared AS INTEGER COPOFF :' COPPERLIST SCROLL OFFSET
DIM SHARED AS INTEGER FPS,FPSS,YYY
DIM SHARED AS DOUBLE OLDTIME
DIM SHARED AS DOUBLE BORDER_CONTROL
DIM SHARED AS STRING MSG
DIM SHARED AS DOUBLE TMPX(90)
DIM SHARED AS DOUBLE TMPY(90)
DIM SHARED AS DOUBLE STMPX(90)
DIM SHARED AS DOUBLE STMPY(90)
DIM SHARED AS DOUBLE MDEL(90)
DIM SHARED AS INTEGER CYCLE=1
DIM SHARED AS INTEGER MMP=0
MSG=MSG+"@@@@@@@@@@@@@@@"
MSG=MSG+"@ STUNNING @"
MSG=MSG+"@ COOL @"
MSG=MSG+"@ ADDICTED TO @"
MSG=MSG+"@ OLDSKOOL @"
MSG=MSG+"@@@@@@@@@@@@@@@"
MSG=MSG+"THIS EFFECT WAS"
MSG=MSG+" VERY WIDELY "
MSG=MSG+" USED IN AMIGA "
MSG=MSG+"DEMOS AND LOOKS"
MSG=MSG+" PRETTY COOL "
MSG=MSG+" I THINK "
MSG=MSG+" SO THIS INTRO "
MSG=MSG+"BEGINS TO SHAPE"
MSG=MSG+"UP! AND I ALSO"
MSG=MSG+"HAVE SOME NICE"
MSG=MSG+"IDEAS STILL TO"
MSG=MSG+" ADD! -- SHOCK "
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SUBROUTINE DECLARATION;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DECLARE SUB PREP_TEXT_GRID()
DECLARE SUB GENERATE_TEXTURES():' TO CREATE TEXTURE MAPS
DECLARE SUB SETBOARDPALETTE():' TO CREATE COPPERLIST FOR BOARD
DECLARE SUB CHESS_SET ():' TO CREATE CHESSBOARD 3D OBJECT
DECLARE SUB CHESS_DRAW():' TO DRAW CHESSBOARD
DECLARE SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
DECLARE SUB DRAWSCROLL():' TO DRAW AND UPDATE THE SCROLLER
declare sub brighten_buffer()
DECLARE SUB ROTATE_BOARD()
DECLARE SUB DRAW_MARGIN()
DECLARE SUB WRITER_ON()
DECLARE SUB WRITER_OFF()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' OPEN SCREEN;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_ALLOWCLOSE(0)
PTC_SETDIALOG(0,"RUN IN FULLSCREEN MODE?",0,0)
IF (PTC_OPEN("((S!P))",XRES,YRES)=0) THEN
END-1
END IF
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' PALETTE AND OBJECT PRECALCULATION ;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PREP_TEXT_GRID()
CHESS_SET ()
GENERATE_TEXTURES()
SETBOARDPALETTE()
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MAIN LOOP;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OLDTIME = TIMER
BORDER_CONTROL=TIMER
WHILE(GETASYNCKEYSTATE(VK_ESCAPE)<>-32767)
GADD=GADD+1
TIMER_SNAPSHOT=TIMER
COPOFF=(HALFY*2)+1+((HALFY*2)*SIN(TIMER_SNAPSHOT))
ROTATE_BOARD()
CHESS_DRAW()
IF CYCLE=0 THEN WRITER_OFF()
IF CYCLE=1 THEN WRITER_ON()
brighten_buffer()
DRAW_MARGIN()
PTC_UPDATE@BUFFER(0)
ERASE BUFFER
FPSS=FPSS+1
IF TIMER-OLDTIME >=1 THEN
FPS=FPSS
PRINT FPS :' <- OUTPUT TO CONSOLE WINDOW ALT + TAB TO SEE.
FPSS=0
OLDTIME=TIMER
END IF
WEND
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' CLEAN UP AND EXIT;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PTC_CLOSE
END
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' TEXTWRITER CONTROL PHASE 1 (LETTERS ON)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB WRITER_ON()
DIM FLAGSET AS INTEGER
DIM L AS INTEGER
DIM VL AS DOUBLE
FLAGSET=1
FOR L=1 TO 90
IF MDEL(L)>8 AND MDEL(L)<9 THEN
TMPX(L) = HALFX
'+(40*SIN(GADD/33))
TMPY(L) = HALFY
'+(40*SIN(GADD/25))
END IF
IF MDEL(L)<8 THEN
VL=MDEL(L)
IF VL<1 THEN VL=1
LARGETEXT(TMPX(L),TMPY(L),MID (MSG,L+MMP,1),VL)
IF TMPX(L) < STMPX(L) THEN TMPX(L) = TMPX(L) + ((STMPX(L) - TMPX(L))/20)
IF TMPX(L) > STMPX(L) THEN TMPX(L) = TMPX(L) - ((TMPX(L) - STMPX(L))/20)
IF TMPY(L) < STMPY(L) THEN TMPY(L) = TMPY(L) + ((STMPY(L) - TMPY(L))/20)
IF TMPY(L) > STMPY(L) THEN TMPY(L) = TMPY(L) - ((TMPY(L) - STMPY(L))/20)
' if TMPX(L) - STMPX(L) >-1 AND TMPX(L) - STMPX(L) < 1 THEN TMPX(L) = STMPX(L)
' if TMPY(L) - STMPY(L) >-1 AND TMPY(L) - STMPY(L) < 1 THEN TMPY(L) = STMPY(L)
END IF
IF MDEL(L)>-50 THEN FLAGSET=0
MDEL(L)=MDEL(L)-.2
NEXT
IF FLAGSET=1 THEN CYCLE=0
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' TEXTWRITER CONTROL PHASE 2 (LETTERS OFF)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB WRITER_OFF()
DIM AS INTEGER FLAGSET = 1
DIM L AS INTEGER
DIM VL AS DOUBLE
FOR L=1 TO 90
IF MDEL(L)<8 THEN
VL=MDEL(L)
IF VL<1 THEN VL=1
LARGETEXT(TMPX(L),TMPY(L),MID (MSG,L+MMP,1),VL)
END IF
IF MDEL(L)>1 AND MDEL(L)<8 THEN
IF TMPX(L) < HALFX THEN TMPX(L) = TMPX(L) + ((HALFX - TMPX(L))/20)
IF TMPX(L) > HALFX THEN TMPX(L) = TMPX(L) - ((TMPX(L) - HALFX )/20)
IF TMPY(L) > HALFY THEN TMPY(L) = TMPY(L) - ((TMPY(L) -HALFY)/20)
IF TMPY(L) < HALFY THEN TMPY(L) = TMPY(L) + ((HALFY - TMPY(L))/20)
END IF
MDEL(L)=MDEL(L)+.2
IF MDEL(L)<8 THEN FLAGSET=0
NEXT
IF FLAGSET=1 THEN
CYCLE=1
MMP=MMP+90
IF MMP>(LEN(MSG)+90) THEN MMP=0
END IF
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' CREATE TARGET POINTS FOR LETTERS OF TEXT WRITER.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB PREP_TEXT_GRID()
DIM AS INTEGER XX,YY,L
DIM AS INTEGER SSXX,SSYY
DIM AS DOUBLE TXD
SSXX=161
SSYY=200
TXD=150
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XX=SSXX
YY=SSYY
FOR L=1 TO 90
STMPX(L) = XX
STMPY(L) = YY
MDEL(L)=TXD
'MDEL(L)=50+(RND(1)*100)
TXD=TXD-1.5
XX=XX+32
IF L MOD 15=0 THEN
XX=SSXX
YY=YY+36
END IF
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' THIS TAKES CARE OF THE BORDERS;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB DRAW_MARGIN()
LMARGIN=80+38*SIN(FUCKADD/11)
RMARGIN=80-38*SIN(FUCKADD/13)
TMARGIN=80+38*SIN(FUCKADD/14)
BMARGIN=80-38*SIN(FUCKADD/12)
IF TIMER-BORDER_CONTROL>1 THEN
FUCKADD=FUCKADD+1
END IF
IF TIMER-BORDER_CONTROL>4 THEN BORDER_CONTROL = TIMER
DIM AS INTEGER Y , SLICE
DIM AS UINTEGER MCL
DIM AS UINTEGER PTR PP1,PP2,PP3,PP4
PP1=@BUFFER(LMARGIN)
PP2=@BUFFER(XRES-RMARGIN)
PP3=@BUFFER(0)
PP4=@BUFFER((XRES-RMARGIN)+1)
FOR Y=0 TO YRES-1
MCL = bpl(200,y+copoff)
*PP1 = &HFFFFFF
*PP2 = &HFFFFFF
PP1+=XRES
PP2+=XRES
SLICE = LMARGIN
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP3]
rep stosd
end asm
SLICE = RMARGIN-1
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP4]
rep stosd
end asm
PP3+=XRES
PP4+=XRES
NEXT
'-------------------------------------------------------------------------
' TOP BITS
'-------------------------------------------------------------------------
PP1=@BUFFER(LMARGIN)
PP3=@BUFFER(0)
PP4=@BUFFER((XRES-RMARGIN)+1)
FOR Y=0 TO TMARGIN-2
IF Y<TMARGIN-2 THEN
MCL = bpl(300,y+copoff)
ELSE
MCL = &HFFFFFF
END IF
*PP1 = &HFFFFFF
*PP2 = &HFFFFFF
PP4+=XRES
PP3+=XRES
PP1+=XRES
SLICE = LMARGIN
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP3]
rep stosd
end asm
SLICE = RMARGIN-1
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP4]
rep stosd
end asm
IF Y<TMARGIN-2 THEN
MCL = bpl(200,y+copoff)
ELSE
MCL = &hFFFFFF
END IF
SLICE = XRES-(LMARGIN+RMARGIN)
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP1]
rep stosd
end asm
NEXT
'-------------------------------------------------------------------------
' BOTTOM BITS
'-------------------------------------------------------------------------
PP1=@BUFFER(LMARGIN)
PP3=@BUFFER(0)
PP4=@BUFFER((XRES-RMARGIN)+1)
PP1 += XRES*(YRES-(BMARGIN+1))
PP3 += XRES*(YRES-(BMARGIN+1))
PP4 += XRES*(YRES-(BMARGIN+1))
FOR Y=YRES-BMARGIN TO YRES-1
IF Y>YRES-BMARGIN THEN
MCL = bpl(300,y+copoff)
ELSE
MCL = &hFFFFFF
END IF
*PP1 = &HFFFFFF
*PP2 = &HFFFFFF
PP4+=XRES
PP3+=XRES
PP1+=XRES
SLICE = LMARGIN
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP3]
rep stosd
end asm
SLICE = RMARGIN-1
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP4]
rep stosd
end asm
IF Y>YRES-BMARGIN THEN
MCL = bpl(200,y+copoff)
ELSE
MCL = &hFFFFFF
END IF
SLICE = XRES-(LMARGIN+RMARGIN)
asm
mov eax, DWORD PTR[MCL]
mov ecx, [slice]
mov edi, [PP1]
rep stosd
end asm
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' ROTATES THE CHESSFIELD AROUND ONE AXIS;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB ROTATE_BOARD()
DIM AS DOUBLE RGADD
DIM AS DOUBLE MO1,MO2,MMM,NNN
DIM AS INTEGER X,Y
RGADD=.02*SIN(GADD/237)
MO1= COS(RGADD):' GENERATE MATRIX CONSTANT 1
MO2= SIN(RGADD):' GENERATE MATRIX CONSTANT 2
FOR X=1 TO CHESS_RES
FOR Y=1 TO CHESS_RES
'-----------------------------------------------------------------------
' ROTATE THE GRID
'-----------------------------------------------------------------------
NNN=CXP(X,Y)
MMM=CYP(X,Y)
CXP(X,Y) = MO1 * NNN - MO2 * MMM
CYP(X,Y) = MO1 * MMM + MO2 * NNN
NEXT
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' THIS SUBROUTINE DRAWS THE SCROLLTEXT TO THE SCREEN LINEAR INTERPOLATED BETWEEN
' A SET OF POINTS DRAWN DOWN THE SCREEN TO "STRETCH" THE LETTERS.
' ALSO OF NOTE IS THE FACT THAT IT SCROLLS WITHOUT ACTUALLY SHIFTING ANY OF THE
' VALUES IN THE SCROLL BUFFER, IT SIMPLY USES AN OFFSET VARIABLE.
' THIS IS FAIRLY OPTIMISED, MORE CAN BE DONE.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB DRAWSCROLL()
dim as integer CUNT,CUNT2
CUNT = 40*SIN(TIMER_SNAPSHOT*3)
CUNT2= 30*SIN(TIMER_SNAPSHOT*2)
DIM AS INTEGER Y,X,x1,x2
DIM AS DOUBLE SV
DIM AS DOUBLE INTER,STRT
FOR Y=0 TO YRES-1
SV=((CUNT*COS((Y+TIMER_SNAPSHOT+GADD)/27))+(CUNT2*SIN((Y-GADD)/21)))
X2=(HALFX+SV)+70:' GENERATE POINT B
X1=(HALFX-SV)-70:' GENERATE POINT A
STRT = SCROLLPOS*32:' PUT STRT AT CORRECT POINT IN SCROLL IMAGE
INTER = 31 / (x2-x1):' WORK OUT INTERPOLATION VALUE
'-----------------------------------------------------------------------
' DRAW ONE HORIZONTAL LINE OF THE SCROLL
'-----------------------------------------------------------------------
FOR X=X1 TO X2
BUFFER(X+(Y*XRES)) = SCROLL(STRT)
STRT=STRT+INTER
NEXT
'-----------------------------------------------------------------------
' ADVANCE SCROLL POINTER, IF AT END OF BANK - 1 LETTER, RESET IT :-p
'-----------------------------------------------------------------------
SCROLLPOS=SCROLLPOS+1
IF SCROLLPOS>=YRES THEN SCROLLPOS=SCROLLPOS-YRES
NEXT
'-----------------------------------------------------------------------
' SCROLL WITHOUT COPYING ANY DATA :-P
'-----------------------------------------------------------------------
SCROLLPOS=SCROLLPOS+5
IF SCROLLPOS>=YRES THEN SCROLLPOS=SCROLLPOS-YRES
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' JUST MAKE A SIMPLE TEXTURE MAP AND STORE IT IN THE SCROLL BUFFER, LATER WE WILL
' USE THIS TO MAKE A NICER TEXTURE MAP TO COLOUR OUR SCROLL.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB GENERATE_TEXTURES()
DIM AS INTEGER X,Y
FOR Y=0 TO YRES+31
FOR X=0 TO 32
SCROLL(X+(Y*32)) = RGB((X*4) XOR (Y*4) , (X*4) XOR (Y*4),X XOR Y)
NEXT
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' HERE WE CREATE THE COPPERLIST FOR THE CHESSBOARD.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB SETBOARDPALETTE()
DIM AS INTEGER Z,Y
DIM AS DOUBLE X
X=0
FOR Z=0 TO 512
FOR Y=0 TO YRES*4
BPL (Z,Y) = RGB(int(X+1+((X*SIN((Y+30)/120)))),int(X+1+((X*SIN((Y+50)/160)))),int(X+1+((X*SIN((Y+30)/170)))))
NEXT
IF X<125 THEN X=X+(Z/800)
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' SET UP CHESS BOARD;
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_SET()
DIM AS INTEGER Z , Y
DIM AS DOUBLE STRTZ , STRTY , CADD , AZP , AYP
CADD = ( 14000 / CHESS_RES )
STRTZ = .8
STRTY = -6500
AZP = STRTZ
AYP = STRTY
FOR Z=1 TO CHESS_RES
AYP=STRTY
FOR Y=1 TO CHESS_RES
CXP ( Y , Z ) = 850
CYP ( Y , Z ) = AYP
CZP ( Y , Z ) = AZP
AYP = AYP + CADD
NEXT
AZP = AZP + 1
NEXT
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' DRAW CHESS BOARD.. THIS IS THE SLOW BIT!!!! NEEDS OPTIMISING.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SUB CHESS_DRAW()
DIM AS INTEGER Z , Y , X
DIM AS integer TX1 , TY1
DIM AS integer TX2 , TY2
DIM AS integer TX3 , TY3
DIM AS integer TX4 , TY4
DIM AS INTEGER CLICKED,CVLC
CLICKED=CLICKS
CVLC=(250-(BOARDOFFS*10))
FOR Z=1 TO CHESS_RES -1
CLICK=CLICKED
CLICKED=CLICKED+1
IF CLICKED>1 THEN CLICKED=0
FOR Y=1 TO CHESS_RES -1
TX1 = ( CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = ( CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = ( CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = ( CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = ( CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = ( CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = ( CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = ( CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
TX1 = (-CXP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFX
TY1 = (-CYP ( Y , Z ) / (CZP ( Y , Z )+BOARDOFFS) ) + HALFY
TX2 = (-CXP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFX
TY2 = (-CYP ( Y+1 , Z ) / (CZP ( Y+1 , Z )+BOARDOFFS) ) + HALFY
TX3 = (-CXP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFX
TY3 = (-CYP ( Y+1 , Z+1 ) / (CZP ( Y+1 , Z+1 )+BOARDOFFS) ) + HALFY
TX4 = (-CXP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFX
TY4 = (-CYP ( Y , Z+1 ) / (CZP ( Y , Z+1 )+BOARDOFFS) ) + HALFY
IF CLICK=1 THEN
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.7 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.7 )
else
TRIANGLE(TX1,TY1,TX2,TY2,TX3,TY3 , CVLC*1.9 )
TRIANGLE(TX1,TY1,TX4,TY4,TX3,TY3 , CVLC*1.9 )
END IF
CLICK=CLICK+1
IF CLICK>1 THEN CLICK=0
NEXT
CVLC=CVLC-13
NEXT
DIM AS UINTEGER PTR PP1,PP2
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' MIRROR THE CHESSBOARD :-)
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'FOR Y=0 to YRES-1
'
' PP1=@BUFFER((HALFX-40)+(XRES*Y))
' PP2=@BUFFER((HALFX+40)+(XRES*Y))
'
' FOR X=1 TO HALFX-40
' *PP1 = *PP2
' PP1 -= 1
' PP2 += 1
' NEXT
'NEXT
BOARDOFFS=BOARDOFFS+.1
IF BOARDOFFS>1 THEN
BOARDOFFS=BOARDOFFS-1
CLICKS=CLICKS-1
IF CLICKS<0 THEN CLICKS=1
END IF
END SUB
SUB TRIANGLE(BYVAL X1 AS INTEGER , BYVAL Y1 AS INTEGER, BYVAL X2 AS INTEGER , BYVAL Y2 AS INTEGER , BYVAL X3 AS INTEGER, BYVAL Y3 AS INTEGER , BYVAL TC AS INTEGER)
'-------------------------------------------------------------------------
' FLAT TRIANGLE RENDERER WITH ASSEMBLY LANGUAGE RASTERISING BY SHOCKWAVE ^ DBF ^ S!P 2006.
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
' WE NEED TO SORT THESE POINTS INTO ORDER FROM TOP TO BOTTOM, AN EXCHANGE SORT IS OK.
' AS WE ONLY HAVE GOT 3 POINTS TO ARRANGE.
'-------------------------------------------------------------------------
DIM AS INTEGER TEMPX,TEMPY,LO,LI
DIM AS INTEGER PX(3)
DIM AS INTEGER PY(3)
DIM TFLAG AS INTEGER
dim pp as uinteger PTR
DIM AS INTEGER IL1,IL2,SLICE,TTC
TFLAG=0
PX(1)= X1
PX(2)= X2
PX(3)= X3
PY(1)= Y1
PY(2)= Y2
PY(3)= Y3
FOR LO = 1 TO 2
FOR LI =1 TO 2
IF PY(LI+1) <= PY(LI) THEN
TEMPX = PX(LI) : TEMPY = PY(LI)
PX(LI) = PX(LI+1)
PY(LI) = PY(LI+1)
PX(LI+1) = TEMPX
PY(LI+1) = TEMPY
END IF
NEXT LI
NEXT LO
' BOOT OUT INVISIBLE TRIANGLES!
IF PX(1)<0 AND PX(2)<0 AND PX(3)< 0 THEN TFLAG=1
IF PX(1)>XRES AND PX(2)>XRES AND PX(3)>XRES THEN TFLAG=1
IF PY(1)>YRES AND PY(2)>YRES AND PY(3)>YRES THEN TFLAG=1
DIM AS DOUBLE XP1,XP2:' SCREEN POSITIONS.
DIM AS DOUBLE XI1,XI2:' INTERPOLATIONS.
'***
'*** REGULAR TRIANGLE (Y1<Y2 Y2<Y3)
'***
IF PY(1)<PY(2) AND PY(2)<PY(3) or (PY(2) = PY(3)) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(1)
XI1 = (PX(1)-PX(2)) / (PY(2) - PY(1))
XI2 = (PX(1)-PX(3)) / (PY(3) - PY(1))
FOR LO = PY(1) TO PY(2)-1
IF LO>=TMARGIN AND LO<YRES-BMARGIN THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES-RMARGIN THEN IL2=XRES-RMARGIN
IF IL1<LMARGIN THEN IL1=LMARGIN
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
XI1 = (PX(2)-PX(3)) / (PY(3) - PY(2))
XP1 = PX(2)
FOR LO = PY(2) TO PY(3)
IF LO>=TMARGIN AND LO<YRES-BMARGIN THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES-RMARGIN THEN IL2=XRES-RMARGIN
IF IL1<LMARGIN THEN IL1=LMARGIN
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
'***
'*** FLAT TOPPED TRIANGLE Y1=Y2
'***
IF TFLAG=0 AND PY(1) = PY(2) THEN
TFLAG=1
XP1 = PX(1)
XP2 = PX(2)
XI1 = (PX(1)-PX(3)) / (PY(3) - PY(1))
XI2 = (PX(2)-PX(3)) / (PY(3) - PY(2))
FOR LO = PY(1) TO PY(3)
IF LO>=TMARGIN AND LO<YRES-BMARGIN THEN
IF XP1<=XP2 THEN
IL1=XP1
IL2=XP2
ELSE
IL1=XP2
IL2=XP1
END IF
IF IL2>XRES-RMARGIN THEN IL2=XRES-RMARGIN
IF IL1<LMARGIN THEN IL1=LMARGIN
SLICE = IL2-IL1
IF SLICE>0 THEN
TTC = BPL (TC,LO+COPOFF)
PP = @BUFFER(IL1+(LO*XRES))
asm
mov eax,dword ptr[TTC]
mov ecx, [slice]
mov edi, [PP]
rep stosd
end asm
END IF
END IF
XP1=XP1-XI1
XP2=XP2-XI2
NEXT
END IF
END SUB
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' BRIGHTEN BUFFER SUBROUTINE USING MMX INSTRUCTIONS! CHEERS STONEMONKEY!
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub brighten_buffer()
asm
pxor mm7, mm7
mov ecx,XRES
imul ecx,YRES
lea eax,dword ptr[BUFFER]
shl ecx,2
add ecx,eax
bright_loop:
movd mm0,[eax]
punpcklbw mm0, mm7
psllw mm0,1
packuswb mm0, mm7
movd [eax],mm0
add eax,4
cmp eax,ecx
jne bright_loop
emms
end asm
end sub
SUB LARGETEXT(BYVAL LTX AS INTEGER , BYVAL LTY AS INTEGER ,BYVAL LTS AS STRING,BYVAL inter AS double)
DIM AS INTEGER A,MMM,NNN
' lts=UCASE(LTS)
FOR A=1 TO LEN(LTS)
NNN=(ASC(MID(LTS,A,1))-33)
IF NNN>63 THEN NNN=-1
if nnn=0 then nnn=1
MMM=NNN*31
if nnn>0 then LFDRAWIMAGE( LTX,LTY, MMM , 0 , inter)
LTX=LTX+31
NEXT
END SUB
Sub LFLoadDataImage()
dim i as integer
'Loads Color palette
for i = 0 to 255
LFimg_r( i ) = a256nick.bmp.pal (i*3)'Red color
LFimg_g( i ) = a256nick.bmp.pal (i*3+1)'Green color
LFimg_b( i ) = a256nick.bmp.pal (i*3+2)'Blue color
LFimg_r( i ) =(LFimg_r(i) Shl 16) Or (LFimg_g(i) Shl 8 ) Or LFimg_b(i)
Next
for i = 1 to (LFimgx*LFimgy) - 1
LFimg_buffer(i) = a256nick.bmp.raw (i)
next
End Sub
Sub LFDrawImage(byval xpos as integer,byval ypos as integer,byval SX as integer,byval SY as integer,byval inter as double)
dim as integer x,y,pixel,mong,intx,inty,xxx,yyy,LAMER,MV
dim as double XA
dim as double YA
dim as double mash
DIM AS INTEGER FRX,FRY,one,two
DIM CLLO AS INTEGER
CLLO = ((8-INTER)*20)
IF CLLO >250 THEN CLLO=250
two = rgb(CLLO,CLLO,CLLO)
one = rgb(CLLO/4,CLLO/4,CLLO/3)
FRX=1
FRY=1
mash = (32-(32 / INTER))/2
xpos=xpos+mash
ypos=ypos+mash
LAMER = RGB(240,240,240)
MV=0
xxx=xpos
yyy=0
XA = SX
YA = SY
x=sx
y=sy
if inter>1 then
WHILE YA<30
Y=INT(YA)
YA=YA+INTER
MV=0
XA=SX
WHILE XA<SX+31
X=INT(XA)
XA=XA+INTER
pixel = LFimg_buffer(x+(y*lfimgx))
mong = (LFimg_r(pixel) )
intx = xxx
inty = yyy+ypos
if intX > 0 AND intX<XRES AND MONG<>&H000000 then
Buffer( (intX +FRX)+((intY+FRY) * XRES )) = ONE
Buffer( intX +(intY * XRES )) = TWO
END IF
xxx=xxx+1
mv=mv+1
WEND
yyy=yyy+1
xxx=xpos
WEND
else
for Y = 0 to 30
MV=0
for X = SX+1 to SX+31
pixel = LFimg_buffer(x+(y*lfimgx))
mong = (LFimg_r(pixel) )
intx = xxx
inty = yyy+ypos
if intX > 0 AND intX<XRES AND MONG<>&H000000 then
Buffer( (intX +FRX)+((intY+FRY) * XRES )) = ONE
Buffer( intX +(intY * XRES )) = TWO
END IF
xxx=xxx+1
mv=mv+1
next
yyy=yyy+1
xxx=xpos
next
end if
End Sub
A few things that I am puzzling over now are still the final resolution, where can I fit a logo, I am also unhappy with the font too, something needs to be done to make it fit in better.
@SW:
Unbelievable ... that design looks outstanding and like a premium cracktro. Really
like the idea of the moving squares in the corner. Outstanding work, mate !!!
Looking good Shockwave, nice work.
Thanks :) I hope to do a little bit more with this today as I had a half day at work and finally have a few hours of spare time (not to mention half a bottle of wine) so with some luck I'll post an update later on with some source too for the peeps that are following this little intros development.
Also it must be said that it wouldn't look as nice and shiny as it does without a little mmx routine by stonemonkey.
wow that is excellent......keep it good work up
I wish I could do things right third time :) I know first and second time will never be on the cards, third time would do.
I've been playing with the borders, yet again! I was looking at the deforming borders and wondered what the hell I'd done them for, it was impossible to think of an effect that would suit it.
In the end I forced myself to realise that is was an excuse.
It was an excuse to run the intro in 800 X 600 and because it is software rendered, I have to draw every single fucking pixel.
Effectively all I did was letterbox the display so the intro definately won't be going back there.
I spoke to some of my friends, among other things, lightning between the planes was suggested, as was glenze cubes and cute stars..
So I killed off the borders.
I put the board full screen.
Realised that I missed the borders so modified the triangle code slightly to shade the top and bottom parts of the screen and finally added some stars.
I am happier with it but still not happy.
The font needs to be changed to a nicer one, also the stars are not in order at the moment so they need to be done.
Probably I won't use a logo on this screen, I'll grab a splash screen off one of S!P's artists instead :)
Anyway, attached is a zip containing the exe and sources.
Uses ptc_ext (thanks rbraz).
Really nice.
Could you add a timer so that the animation runs at the same speed on any configuration.
IMHO the text should appear from top to bottom and 5 spikes starts would look better.
Yeah, much more nice now, and yes you need better font...
No idea how easy/difficult it would be but some sort of smoothing of the font using alpha around the curved edges would be nice. But really no idea how.
Sweet!
I like how that is looking :) nice colors and shading too
Awesome stuff Shockie ... I really like the stars and the chessboard movement now.
Shocks,
the stars are great , I wouldn't waste time sorting them you cant tell on a first look. I'd like the viewpoint to move more get closer to checker board then away again. But perhaps you hardcoded the angle for speed? Honestly I preferred the bouncing borders but being no artist, I'm probably wrong. Its just I've seen far too many "wide angle cinema scope" borders.
It looks great in any case.
Chris
Wow! Lots of suggestions, thank you everybody I wasn't expecting them! This was just my ramblings as this project progresses slowly...
I will be adding a few of those ideas, you can be sure of that and I really appreciate the testing :)
Here it is with some of those great suggestions implimented! Thanks so much :)
Looking better now, and you did the thing with the alpha edges on the font and it's looking less blocky but something strange is happening when the background is bright, the alpha edges show up a bit.
The improvement of your seconds version is good......the music is good as it seem match the demo itself.
The stars that come toward ya is good. Would be nice to have alpha rainbow fonts or rainbow fonts that stand out in crowd but I am not sure....it just suggest(or just idea)
You doing great with those checkboard and with these checkboard....it can create anythings with it on whatever you wish!
cheers
Very fine improvements you made there Shocky.
Maybe it is just me - but I think the text stays too long on the screen. I would reduce
the delay of this. And maybe doing a different and faster way of letting the letters dis-
appear from the screen....
Just my 2cts.
haven't read the whole topic but i must say it's looking very good :)
love the lighting effects and the stars :)
Waiting for a font from Nuke now before I do any more with this :) Thanks for the comments and suggestions folks!
That chess board is simply awesome candyness.
Its really quite beautiful.
@Shockwave:
SPS.zip == Very impressive and i must say, i really like it a lot... I like the chippy comic bakery sound, the rotated chessboard (even if i dont know nor understand how it works :P), and my beloved old textwriter like in the intro of the amiga game jumping jack'son *yeah* *kicking ass! great work!* :goodpost:
Hehe I remember that game! The music sounded like the rolling stones singing Jumping Jack Flash! So cool.
The music was the best part of that game.
And Chris, thank you for your nice comment :) As soon as I get a font from Nuke I will finish this.
@Shockwave
Did you ever get your font and if so have you got a link to the finished version.
Quote from: Shockwave on July 25, 2007
Waiting for a font from Nuke now before I do any more with this :) Thanks for the comments and suggestions folks!
Looks absolutely stunning mate
:)
No, this one went in the dustbin! It was just one of those things I could never finish. :)
No worries mate I'll settle on the last version in this thread.Reading this thread from the start gives me an insight on how you go about making demos and how it evolves from a flash of inspiration and ideas from other members.Brilliant stuff
:inspired: :inspired: :inspired:
don't drop it! this is f***ing cool! I see some heavy inspiration from the M.A.D. cracktro by Stormlord but that's exactly the kind of stuff I'd like to see these days. Some great old-school FX with some new-school improvements. There is really a lot you can do with these zoom-writers....
I'd just suggest to speed-up the zooming of the letters because it shows some pixel-adjustments when reaching the front plane (I experienced the same when debugging the M.A.D. cracktro). A faster motion would look better. Maybe less delay between chars so it looks like a spray. The "comic bakery" remix is speedy enough to handle as speedy writer.
My last question, when do you plan to release this? ;)
Yeah Shocky. Pick this code up again - its totally worth it!
The campaign to get this finished and released starts here.
:protest:
:)
Maybe I'll re-code it in Opengl and release it at Sundown. :)
Yeah, this 90% complete intro is crazy...
I absolutely love it...
Nick ! Don't drop this mate this is
awesome !
my 2 cents
for the moving border with the white zooming letters , wouldn't it be nice if those letters where made of bobs?
the second design i like that one very much too, i think the only change needed in both designs is the font and the coloring of the font.
other than that , both are very very nice ;D
Looks like I need to finish it....
Quote from: Shockwave on October 05, 2009
Looks like I need to finish it....
Yeah, please do :)
Quote from: Shockwave on October 05, 2009
Looks like I need to finish it....
I know your time is precious but it would be great if you could give us the finished version because even unfished this is stunning.Please pretty please :)
How's this old thing going Shockie??
Lets start a petition....
Haha, two years later and I still can't escape from this :)
Slippy asked me if he could use this code and I think he had made something with it, as far as I know though, nothing else has been done with it!
Sorry to sound dumb but what ver of freebasic are you using?
An old one! I haven't upgraded it since I installed it. V 0.15 I think.
Thanks for the reply, I am playing with FreeBasic but it would seam that most of the sample code from the net wont compile, I guess that it must be a version problem, It sure is hard to find anything worth playing with.