Thank you guys for responding. Yes the set object was just testing and the positioning was a quick way to drop it below me to see it. I have used Gandaff shader and finaly learned to blend using height. Looks real good but the problem now is... I dont want to blend textures for height, I want to decide where I want the textures. I use l3dt But I cant figure out the alphamapping so I can texture splatter. I have a Fps That I have been working on for a while and alot done But I cant deal with the terrain like it is so I am now trying to learn the shaders. here is a condensed version of my engine with The texure blend shader. Could you please explain alphamapping with texture stage. One guy said it has a certain order the textures go but as I look I see others using stages and there textures are not the same type of order.
Example:
he said normals go on stage 3 and alpha on stage 1 but I have seen other that are not that way and work.
Thank you for your help
Rem Project: TLV_TEST_ENGINE
Rem Created: 5/3/2009 4:31:52 PM
Rem ***** Main Source File *****
`================================================================================
`=---------------------------DISPLAY--------------------------------------------=
`================================================================================
RANDOMIZE TIMER()
Sw=1280:Sh=1024
SET DISPLAY MODE Sw,Sh,32,1
SYNC ON : SYNC RATE 75
SET GAMMA 255,255,255
BACKDROP OFF
AUTOCAM OFF
HIDE MOUSE
SET NORMALIZATION ON
`================================================================================
`=-----------------------SET-DIRECTORIES----------------------------------------=
`================================================================================
SET DIR "D:\Game Development\Compilers\Dark Basic Pro\Projects\TLV_TEST_ENGINE\"
`#include "deferred.dba"
`Deferred SetUp
`position camera 0,250,0
`Post Filter SetUp
` PostFilter_GlowDOFShafts(1,1,1)
`Water Setup
` Water_Setup()
`Set Ambient and Fog
` Deferred_SetAmbient(62,62,62,2.0)
` Deferred_SetFog(255,227,214,20000*0.9)
`
`#######################################################################################################################
`#---------------------------------------PLAYER-VARIBLES---------------------------------------------------------------#
`#######################################################################################################################
v = make vector4(1)
HEALTH# = 100
AG# = AW# ` Weapon change varible
`--------------------------------------------------
`--------------PLAYER-&-WEAPONS-&-AMMO-------------
`--------------------------------------------------
`-----------------PLAYER-CREATION------------------
PYR = 1 ` Player Object Value
DUMMY = 9000
Limb1 = 9001 `For Handling Weapons
Limb2 = 9002 `For Shooting Checks
Limb3 = 9003 `For Ground Checks
LIMB4 = 9004
`----------------------WEAPONS---------------------------------------------------
MM_9 = 2 ` 9MM Object Value
C_45 = 3 ` 45C Object Value
MP_5 = 4 ` UMP40 Object Value
MAC_10 = 5 ` MAC 10 ObjeCT Value
DMC_10 = 6 ` Dual MC10 Object Value
JK_HR = 7 ` Jackhammer Object Value
S_S = 8 ` Super Shorty Object Value
SH_GUN = 9 ` Pump Shotgun Object Value
AK_47 = 10 ` AK_47 Object Value
M_16 = 11 ` M16 Object Value
UZI = 12
AR_50 = 13
MP_5A = 14
M_16_1 = 15
`----------------------WEAPONS-FLASH---------------------------------------------
FLASH = 50
`----------------------AMMO------------------------------------------------------
MM_9Amo = 20 `9mm Ammo
M_16_AM = 21
`########################################################################################################################
`#-------------------------------------ENVIROMENT-&-BEACH-VARIBLE-------------------------------------------------------#
`########################################################################################################################
intBoxNum = 104 `SKY
ter = 101 `TERRAIN
OCEAN = 102 `WATER
OBJ = 103
`------------------------WEAPON-CHANGE-------------------------------------------
MP5# = MP_5
MAC_10# = MAC_10 ` MC10 Objetc Varible
AK_47# = AK_47 ` AK_47 Object Value
M_16# = M_16 ` M16 Object Value
AR_50# = AR_50
UZI# = UZI
`================================================================================
`=-----------------------GLOBAL-------------------------------------------------=
`================================================================================
`SET GLOBAL SHADOW COLOR 0,0,0,1
GLOBAL RADIUS# AS DOUBLE FLOAT : RADIUS# = 4
Global PRotY# = 2.0
GLOBAL PRotZ# = 2.0
GLOBAL SKYrotY# = 2.0
Global z# = .05
GLOBAL Bro#=bro#
GLOBAL TER = 90
`------------------------------PLAYER-MOVEMENT-VECTOR----------------------------
GLOBAL vx# AS DOUBLE FLOAT
GLOBAL vy# AS DOUBLE FLOAT
GLOBAL vz# AS DOUBLE FLOAT
GLOBAL gravity# AS DOUBLE FLOAT : gravity# = -0.2
GLOBAL slope# AS DOUBLE FLOAT : slope# = 0.107
GLOBAL ground AS INTEGER : ground = 1
GLOBAL jumptimer AS INTEGER : jumptimer = 0
GLOBAL view as integer : view = 1
`================================================================================
`=---------------------------------LIGHTS---------------------------------------=
`================================================================================
POSITION LIGHT 0,-8820,1743,1844
HIDE LIGHT 0
SET AMBIENT LIGHT 75
COLOR AMBIENT LIGHT RGB(254,234,203)
`-------------------------------SHADOWING----------------------------------------
` set shadow mode to 'light' mode,ie shadows will be cast from selected light number
` in this case is 1 (x, y and z values will be ignored)
` you can also use value of -1 which means you can force position of shadows
`lightmode=-1
`set shadow position lightmode,-5200,7350,10350
LOAD IMAGE "grass1s.png",5
load image "Terrain c.png",1
Load image "Terrain n.png",3
load image "tiles.jpg",4
load image "grass.png",2
load image "rock.png",6
LOAD IMAGE "crosshair.png",111
`LOAD IMAGE "M16FLASH1.JPG",112
` LOAD IMAGE "detail.tga", 12
`LOAD IMAGE "ter_texture.png", 13
`LOAD IMAGE "VISUAL_TOWER_DEAD_WOOD.BMP",14
`LOAD IMAGE "VISUAL_TOWER_DARK_WOOD.BMP",15
`LOAD IMAGE "VISUAL_TOWER_WOOD.BMP",16
`load image "grass1s.png", 4
` load image "rock4s.png", 2
` load image "sand1s.png", 3
` load image "gravel1s.png", 1
` load image "grass1s nmp.png", 8
` load image "rock4s nmp.png", 6
load image "sand1s nmp.png", 7
load image "gravel1s nmp.png", 8
`================================================================================
`=--------------------------CHARACTER-LOAD-PLAYER-------------------------------=
`================================================================================
MAKE OBJECT SPHERE PYR,radius#
`POSITION OBJECT PYR,-2500,20000,-2500
`POSITION OBJECT PYR,1858.51428223,166.409194947,-2282.37159203
HIDE OBJECT PYR
MAKE OBJECT SPHERE DUMMY,radius#*.05
`POSITION OBJECT DUMMY, 6874,551,10370``19092,10000,10451
HIDE OBJECT DUMMY
SHOW OBJECT BOUNDS DUMMY, 1
`POSITION OBJECT PYR,2119,6000,-2500
`POSITION OBJECT intBoxNum, pxp#,PYP#,PZP#
`POSITION CAMERA 1,4000,100,4000
`phy make rigid body dynamic sphere dummy
sc_setupobject dummy,0,1
T_Dummy = 567
make object sphere T_Dummy,500
hide object T_Dummy
`==================================================
`=---------------SKY-TERRAIN-WATER----------------=
`==================================================
`---------------------SKY--------------------------
LOAD OBJECT "cielo.x",intBoxNum
YROTATE OBJECT INTBOXNUM,180
SET OBJECT LIGHT intBoxNum,0
SCALE OBJECT intBoxNum,89000000000,89000000000,89000000000`43000,125000
SET OBJECT TEXTURE intBoxNum,2,1
SET OBJECT CULL intBoxNum,0
`scale object intBoxNum, 90000, 110000, 90000 ` Box will be too small without this!
POSITION OBJECT intBoxNum, 17090,-900,28934.9980469 ` Center box in the scene
`position camera 0,0,0 ` Position camera INSIDE the box
`SET OBJECT FOG intboxnum,1
`SET OBJECT AMBIENCE INTBOXNUM,RGB(186,220,245)
`SET OBJECT AMBIENT INTBOXNUM,1
`hide object intboxnum
`SKYSX# = 25000
`SKYSY# = 20000
`SKYSZ# = 25000
`pter = 1987
`LOAD OBJECT "terrain.dbo",Pter
load effect "GG Blended Bump Mapping Shader.fx",1,1`:Deferred_AddEffect(1)
`POSITION OBJECT Pter,7000,-45000,9000
`SCALE OBJECT pter,550000,1550000,550000
`SET OBJECT LIGHT pter,1
`set object effect pter,1
`texture object pter,1,11
`texture object pter,2,21
`texture object pter,3,31
`texture object pter,4,41
`texture object pter,5,51
`texture object pter,6,61
`pter1 = 1873
`Terrain Normals
` load object "Terrain.dbo",pter1
` load effect "Terrain Normals.fx",2,0:Deferred_AddEffect(2)
` load image "rocksand n.png",71
` load image "grass n.png",81
` load image "rock n.png",91`
` set object effect pter1,2
` texture object pter1,1,11
` texture object pter1,2,21
` texture object pter1,3,31
` texture object pter1,4,71
` texture object pter1,5,81
` texture object pter1,6,91
`Deferred_AddTerrain(pter,pter1)
`------------------Terrain------------------------
MAKE OBJECT TERRAIN ter ` CREATE THE TERRAINt
SET TERRAIN HEIGHTMAP ter, "terrain20.jpg" ` SET THE HEIGHTMAP
SET TERRAIN SCALE ter, 55,42,55 ` 0.8 ,6`14,6,14 ` SET THE SCALE
SET TERRAIN SPLIT ter, 16 ` SPLIT VALUE BY 16 * 16
SET TERRAIN TILING ter, 16 ` DETAIL MAP TILING
`set terrain light 90,1,-0.25,0,1,1,0.78,1000
` SET TERRAIN LIGHT ter,1, -0.25, -1,.15, .18, .29, 100 ` LIGHT - XDIR, YDIR, ZDIR, RED, GREEN, BLUE, INTENSITY
` SET TERRAIN TEXTURE ter, 13,12 ` base and detail texture
BUILD TERRAIN ter ` finally build the terrain
`ghost object on ter
`hide object ter
texture object ter,0,1
texture object ter,1,2
texture object ter,2,3
texture object ter,3,4
texture object ter,4,5
texture object ter,5,6
texture object ter,6,7
texture object ter,7,8
convert object fvf ter,530
`convert object fvf ter,400
` texture object ter ,0,12
`texture object ter ,1,13
`texture object ter ,4,47
`set bump mapping on ter,47
POSITION OBJECT ter,0,0,0
set object effect ter,1
contrast# = 2.0
vertScale# = 2.0/object size y(ter,1)
set effect constant float 1, "contrast", contrast#
set effect constant float 1, "vertScale", vertScale#
set vector4 1, 128, 128, 128, 32
set effect constant vector 1, "UVTiling", 1 ` hide object ter
PHY MAKE RIGID BODY STATIC TERRAIN TER
`scale object texture ter,2,24,24
Y# = GET TERRAIN ground HEIGHT(ter,x#,z#)
SC_SETUPcomplexobject 90,1,1234
POSITION OBJECT DUMMY, 13553,object position y(ter)+25000,13478
`================================================================================
`=----------------------------WEAPONS-------------------------------------------=
`================================================================================
`---------------------------M_16------------------------------------------------
LOAD OBJECT "m_16.x" ,M_16
SCALE OBJECT M_16,20010,20010,18010
XROTATE OBJECT M_16,180
ZROTATE OBJECT M_16,180
yrotate object M_16,1
SET OBJECT M_16,1,1,0,2,1,0,1
SET OBJECT SPECULAR M_16,RGB(205,211,243)
SET OBJECT SPECULAR POWER M_16,0.7
SET OBJECT diffuse M_16,RGB(125,125,125)`88,88,88)
SET OBJECT AMBIENCE M_16,RGB(175,175,175)`25,25,25)
` SET SOUND SPEED 1526,52551
`SET OBJECT SPEED M_16,45
set object cull m_16,0
MAKE OBJECT PLAIN FLASH,10,10
ZROTATE OBJECT FLASH,135
YROTATE OBJECT flash,15
`TEXTURE OBJECT FLASH,7
GHOST OBJECT ON FLASH
SET OBJECT FLASH,1,0,0,0,0,0,1
`disable object zdepth m_16
`Crosshair
MAKE OBJECT PLAIN 9998,100,100
TEXTURE OBJECT 9998,111
GHOST OBJECT ON 9998
SET OBJECT DIFFUSE 9998,RGB(0,255,0)
SET OBJECT AMBIENCE 9998,RGB(0,255,0)
SET OBJECT 9998,1,1,0,0,0,0,1
POSITION OBJECT 9998,CAMERA POSITION X(),CAMERA POSITION Y()-20,CAMERA POSITION Z()+1005
LOCK OBJECT ON 9998
MAKE OBJECT TRIANGLE limb1,.00,.00,.00,.00,.00,.00,.00,.00,.00
MAKE OBJECT TRIANGLE LIMB2,0,0,0,0,0,0,0,0,0
MAKE OBJECT TRIANGLE LIMB3,0,0,0,0,0,0,0,0,0
MAKE OBJECT TRIANGLE limb4,0,0,0,0,0,0,0,0,0
MAKE MESH FROM OBJECT 1,limb1
MAKE MESH FROM OBJECT 2,limb2
MAKE MESH FROM OBJECT 3,limb3
MAKE MESH FROM OBJECT 4,LIMB4
ADD LIMB 1,1,1
ADD LIMB 1,2,2
ADD LIMB 1,3,3
add LIMB 1,4,4
`GHOST OBJECT ON 90
HIDE LIMB 1,1
HIDE LIMB 1,2
HIDE LIMB 1,3
HIDE LIMB 1,4
OFFSET LIMB 1,1,3,-15,12
OFFSET LIMB 1,2,OBJECT POSITION X(PYR), OBJECT POSITION Y(PYR)+35, OBJECT POSITION Z(PYR)+50000
OFFSET LIMB 1,3,OBJECT POSITION X(PYR), OBJECT POSITION Y(PYR)-10, OBJECT POSITION Z(PYR)
OFFSET LIMB M_16,1,OBJECT POSITION X(m_16), OBJECT POSITION Y(m_16), OBJECT POSITION Z(m_16)
DELETE OBJECT Limb1
DELETE OBJECT Limb2
DELETE OBJECT Limb3
DELETE OBJECT Limb4
SCALE LIMB PYR,1,.1,.1,.1`LOCK OBJECT ON M_16
` POSITION OBJECT SH_GUN, LIMB POSITION X(PYR,1)-30,LIMB POSITION Y(PYR,1)+75,LIMB POSITION Z(PYR,1)-20
POSITION OBJECT M_16, limb POSITION X(PYR,1)-2800, limb POSITION Y(PYR,1)+13100, limb POSITION Z(PYR,1)-10800
POSITION OBJECT FLASH, limb POSITION X(m_16,1)-1003.1, limb POSITION Y(m_16,1)-2478.1,limb POSITION Z(m_16,1)+1275
GLUE OBJECT TO LIMB M_16,PYR,1
GLUE OBJECT TO LIMB FLASH,m_16,1
AW# = M_16#
rem Set light variables
LightNum=0
XPos#=100
YPos#=100
ZPos#=100
Range#=1000
rem Set the shadow light to where light 0 will be.
Set Shadow Light Lightnum,XPos#,YPos#,ZPos#,Range#
rem Position light 0 where the shadow light is.
Position light 0,XPos#,YPos#,ZPos#
rem Set light 0's range to the shadow light's range.
Set Light Range 0,Range#
`########################################################################################################################
`#-----------------------------------------------PLAYER-SETTINGS--------------------------------------------------------#
`########################################################################################################################
PXP# = OBJECT POSITION X(PYR)
PYP# = OBJECT POSITION Y(PYR)
PZP# = OBJECT POSITION Z(PYR)
SET CAMERA RANGE 0,0.1,9550000
SET CAMERA FOV 0,70
DO
text 20, 18, "FPS = "+str$(screen fps())
text 20, 36, "cam pos = "+str$(xp#,0)+", "+str$(yp#,0)+", "+str$(zp#,0)
text 20, 60, "press c/v to increase/decrease blending contrast: "+str$(contrast#, 2)
text 20, 78, " h/j to increase/decrease vertical blend: "+str$(vertScale#,3)
text 20, 96, " t to toggle bumpmapping (0=off, 1=on): "+str$(t)
if inkey$()="c" then contrast# = contrast# * 1.03 ` faster machines will need to
if inkey$()="v" then contrast# = contrast# * 0.97 ` make these closer to unity
if inkey$()="h" then vertScale# = vertScale# * 1.03
if inkey$()="j" then vertScale# = vertScale# * 0.97
if keyNow=0 and inkey$()="t" then t = 1 - t: keyNow = 1
if inkey$()="" then keyNow = 0
set effect constant float 1, "contrast", contrast#
set effect constant float 1, "vertScale", vertScale#
if t=0 then set effect technique 1, "t0" ` no bumpmapping
if t=1 then set effect technique 1, "t1" ` bumpmapping
`================================================================================
`=--------------------------------SUBROUTINES-----------------------------------=
`================================================================================
GOSUB BASIC_CONT:
GOSUB STATS:
`gosub deferred:
PXP# = OBJECT POSITION X(PYR)
PYP# = OBJECT POSITION Y(PYR)
PZP# = OBJECT POSITION Z(PYR)
M16x# = OBJECT POSITION X(M_16)
M16y# = OBJECT POSITION Y(M_16)
M16z# = OBJECT POSITION Z(M_16)
Lx# = Limb POSITION X(PYR,1)
Ly# = Limb POSITION Y(PYR,1)
LZ# = Limb POSITION Z(PYR,1)
sx#=OBJECT POSITION X(intboxnum)
sy#=OBJECT POSITION Y(intboxnum)
sz#=OBJECT POSITION Z(intboxnum)
terx# = OBJECT position X(90)
tery# = OBJECT position Y(90)
terz# = OBJECT position Z(90)
oldx# = OBJECT POSITION X(dummy)
oldy# = OBJECT POSITION Y(dummy)
oldz# = OBJECT POSITION Z(dummy)
camx# = CAMERA POSITION X(0)
camy# = CAMERA POSITION Y(0)
camz# = CAMERA POSITION Z(0) rem apply gravity, and user changes to movement
angy# = OBJECT ANGLE Y(dummy)
vx# = 0
vz# = 0
bx# = 0
bz# = 0
cax# = camera ANGLE X(0)
cay# = camera ANGLE Y(0)
caz# = camera ANGLE Z(0)
` fire a sphere when space key is pressed
rem if player is jumping or falling then apply 'normal' gravity
rem if not attempt to keep the player stuck to the floor
if shiftkey() = 1
speed = 4
else
speed = 2
endif
yrotate object DUMMY,object angle Y(DUMMY)+mousemovex()/3.0
xrotate object DUMMY,object angle X(DUMMY)+mousemovey()/3.0
IF OBJECT ANGLE X(DUMMY)>90 THEN XROTATE OBJECT DUMMY,90
IF OBJECT ANGLE X(DUMMY)<-90 THEN XROTATE OBJECT DUMMY,-90
yrotate object PYR,object angle Y(DUMMY)
xrotate object PYR,object angle X(DUMMY)
IF vy#=0 AND jumptimer=0 THEN vy# = vy# + 15*gravity# ELSE vy# = vy# + gravity#
IF KEYSTATE(32)=1 THEN vx# = VX# + COS(angy#)*speed : vz# = -VZ# - SIN(angy#)*speed
IF KEYSTATE(30)=1 THEN vx# =-VX# - COS(angy#)*speed : vz# = VZ# + SIN(angy#)*speed
IF KEYSTATE(31)=1 THEN vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
IF MOUSECLICK()=2 THEN vx# = VX# + SIN(angy#)*speed : vz# = VZ# + COS(angy#)*speed
IF MOUSECLICK()=3 THEN vx# = VX# + SIN(angy#)*speed : vz# = VZ# + COS(angy#)*speed
IF KEYSTATE(31)=1 AND MOUSECLICK()=2 THEN vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
IF KEYSTATE(31)=1 AND KEYSTATE(32)=1
vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
vx# = -VX# + COS(angy#)*speed : vz# = VZ# - SIN(angy#)*speed
ENDIF
IF keystate(31)=1 and keystate(30)=1
vx# =-VX# - SIN(angy#)*speed : vz# = -VZ# - COS(angy#)*speed
vx# = VX# - COS(angy#)*speed : vz# = -VZ# + SIN(angy#)*speed
ENDIF
rem only jump if on ground, and a certain time after last jump
IF GROUND = 0 AND KEYSTATE(43)=1
ANIMATE = ANIMATE + 1
IF animate = 1 THEN POSITION CAMERA 0,camx#,CAMY#-0.5,camz# `move object down pyr,.5
IF animate = 4 THEN POSITION CAMERA 0,camx#,CAMY#-1.0,camz# `move object down pyr,.5
IF animate = 7 THEN POSITION CAMERA 0,camx#,CAMY#-1.5,camz# `move object down pyr,.5
IF animate = 10 THEN POSITION CAMERA 0,camx#,CAMY#-2.0,camz# `move object down pyr,.5
IF animate = 15 THEN POSITION CAMERA 0,camx#,CAMY#-1.5,camz# `move object down pyr,.5
IF animate = 18 THEN POSITION CAMERA 0,camx#,CAMY#-1.0,camz# `move object down pyr,.5
IF animate = 21 THEN POSITION CAMERA 0,camx#,CAMY#-0.5,camz# `move object down pyr,.5
IF animate = 22 THEN animate = 0
ENDIF
IF ground=1
IF spacekey()=1 AND jumptimer=0 THEN vy# = vy# + 5.2 : jumptimer = 10
ENDIF
DX# = OBJECT POSITION X(DUMMY)
DY# = OBJECT POSITION Y(DUMMY)
DZ# = OBJECT POSITION Z(DUMMY)
rem this would be the player's final position without collision
x# = oldx#+vx#
y# = oldy#+vy#
z# = oldz#+vz#
rem first handle gravity - seperated from horizontal movement
rem to achieve a more realistic effect
rem Method: simple - cast a sphere vertically down, if it hits the level then
rem position the object there (sticky collision) then move
rem on to horizontal movement
rem more complex - if we were to only use the simple method the player would be
rem allowed to climb almost vertical slopes. Alternative is to
rem get the normalY direction to work out how flat the gorund
rem below the player is, 0-slope# is flatter, slope#-1 is steeper.
rem if it's flat, use sticky collision, if it's steep slide the
rem player down the slope. Changing slope# determines how steep the
rem player can climb. NOTE: this also effects stairs.
collide = sc_SphereCastGroup(0,oldx#,oldy#,oldz#,oldx#,oldy#+vy#,oldz#,radius#,0)
IF collide>0
rem how flat is this ground
ny# = sc_getCollisionNormalY()
IF ABS(ny#)>slope#
rem FLAT, stick
oldy# = sc_getStaticCollisionY()
ELSE
rem STEEP, slide
x# = x# - oldx# : z# = z# - oldz#
oldx# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
oldz# = sc_getCollisionSlideZ()
x# = x# + oldx# : z# = z# + oldz#
ENDIF
rem ny#<0 means the player has hit a ceiling rather than a floor
IF ny#>slope#
rem only on ground if standing on flat ground
ground = 1
vy# = 0
ELSE
ground = 0
rem if player has hit a flat ceiling then stop vy# movement
IF ny#<-slope# THEN vy# = gravity#
ENDIF
ELSE
rem nothing below player, not on ground, add vertical speed to player
oldy# = oldy# + vy#
ground = 0
ENDIF
rem jumptimer will decrease only when player is back on ground
rem creates a pause between two successive jumps
IF ground = 1 AND jumptimer>0 THEN DEC jumptimer
rem handle horizontal movement as sliding
rem player only collides with group 1 (level) objs and moves freely through others
collide = sc_SphereSlideGroup(0,oldx#,oldy#,oldz#,x#,oldy#,z#,radius#,0)
IF collide>0
rem if hit, reposition player, halt movement vector
x# = sc_getCollisionSlideX()
oldy# = sc_getCollisionSlideY()
z# = sc_getCollisionSlideZ()
vx# = 0
vz# = 0
rem possible code for giving the player a jumping help up stairs...
rem might be useful if slope# is set very high but stairs are still required
` dy# = oldy#-sc_getStaticCollisionY()
`if dy#<slope# and dy#>0 and ground=1 then vy# = 0.5
ENDIF
rem position the player
`POSITION OBJECT PYR,PXP#,Y# +50,PZP#
POSITION OBJECT DUMMY,x#,OLDY#,z#
POSITION OBJECT PYR,OBJECT POSITION X(DUMMY),OBJECT POSITION Y(DUMMY)+76,OBJECT POSITION Z(DUMMY)
position object T_Dummy,OBJECT POSITION X(DUMMY),OBJECT POSITION Y(DUMMY),OBJECT POSITION Z(DUMMY)
sc_updateObject DUMMY
`function positionCameraToObject(obj,thirdPerson)
POSITION CAMERA 0, OBJECT POSITION X(pyr),OBJECT POSITION Y(pyr),OBJECT POSITION Z(PYR)
ROTATE CAMERA 0,OBJECT ANGLE X(PYR),OBJECT ANGLE Y(PYR),OBJECT ANGLE Z(PYR)
`if thirdPerson=1
`pitch camera down 1, 10
`move camera 1,-30
`endif
`endfunction
` position object ene, object position x(ene), get terrain ground height(ter, object position x(ene), object position z(ene)),object position z(ene)
` position object ene1, object position x(ene1), get terrain ground height(ter, object position x(ene1), object position z(ene1)),object position z(ene1)
`Set DOF
` if PostDOFEnabeld=1
` ob=pick object(screen width()/2,screen height()/2,1,1)
` GDis#=GET PICK DISTANCE()
` if Ob=0 then GDis#=10000
` Focus#=curvevalue(GDis#,Focus#,20)
` set effect constant float PostFrameTarget(1).FrameTargetEffect,"DOFFocus",Focus#*5
`endif
update terrain 1
`AI UPDATE
text 0,screen height()-75,"Player position x: "+str$(Pxp#)
text 0,screen height()-50,"Player position y: "+str$(Pyp#)
text 0,screen height()-25,"Player position z: "+str$(Pzp#)
cgx#=limb position x(pyr,1)
cgz#=limb position z(pyr,1)
cgy#=limb position y(pyr,1)
` Water_Update()
`PostFilter Update
` PostFilter_Update()
`Deferred_Update()
SYNC
LOOP
delete memblock 1
`================================================================================
`=------------------------POLY-COUNTER------------------------------------------=
`================================================================================
stats:
`
rem reveal value
if tmdisplaywait>0 then dec tmdisplaywait
`
rem stat panel slides
`
rem fps, poly and timing stats
if tmdisplaywait<10
col as dword : col=(255-(25*tmdisplaywait))
colb=(col<<24) : colw=(col<<24)+(col<<16)+(col<<8)+(col)
s1$="POLY:"+str$(statistic(1)/1000)+"k FPS:"+str$(screen fps())
ink colb,0 : center text (screen width()/2)+1,(screen height()-40)+1,s1$
ink colw,0 : center text screen width()/2,screen height()-40,s1$
if tmglob>0
p1#=tmsync : p2#=tmglob : p1b#=tmphys : p2b#=tmglob : p1c#=tmrest : p2c#=tmglob
s2$="TIMING "+" DRAW:"+str$((p1#/p2#)*100,0)+"% AI:"+str$((p1b#/p2b#)*100,0)+"% CODE:"+str$((p1c#/p2c#)*100,0)+"%"
ink colb,0 : center text (screen width()/2)+1,(screen height()-30)+1,s2$
ink colw,0 : center text screen width()/2,screen height()-30,s2$
endif
endif
`
return