TGC Codebase Backup



Juxta Tempus (Incomplete RPG Engine) by x1b

20th Jan 2006 20:48
Summary

3rd release of the Juxta Tempus OpenSource RPG Engine. Very incomplete. NGC 2.03 && BlueGUI required



Description

Juxta Tempus is a Learn as I go, OpenSource RPG Project. Progress is released to the TGC Community for their personel use. If you use this source, in whole or in part, please give credit to x1b,Lost In Thought & Megaton Cat



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    randomize timer()
startBlue "000","00000"



      rem constant
      #Constant type_ngc_ellip=1
      #Constant type_ngc_mesh=2

      #Constant ellip_2_ellip=1
      #Constant ellip_2_poly=2

      #Constant resp_stick=1
      #Constant resp_slide=2
      #Constant resp_slide_no_slopes=3
      #Constant resp_slide_no_grav=4
      #Constant resp_none=5

      #Constant dyn_no_resp=1
      #Constant dyn_resp=2
      #Constant dyn_resp_lock=3
      #Constant dyn_resp_lock_noturn=4

      rem collision type constant
      #Constant type_Player =1
      #Constant type_World  =2

     rem Initialize collision system
     StartCollisionPRO(000000000,000000000,000000000)

     rem Collision Instructions
     SetCollisionsPro(type_Player, type_World, ellip_2_poly, resp_slide_no_grav, dyn_no_resp)



global m2pressed  as integer
global mouseval   as integer
global x#         as float
global y#         as float
global z#         as float

NUM_RL_SMOKE_PARTICLES =30
num_smoke_stacks =3
dim beg_smoke_num(num_smoke_stacks-1)
a =6000
for i =0 to num_smoke_stacks-1
   beg_smoke_num(i) =a
   temp =NUM_RL_SMOKE_PARTICLES + 1
   inc a, temp
next i

dim RLSmoke_BasePos_X(num_smoke_stacks-1) as float
dim RLSmoke_BasePos_Y(num_smoke_stacks-1) as float
dim RLSmoke_BasePos_Z(num_smoke_stacks-1) as float
dim RLSmoke_Pos_X(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Pos_Y(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Pos_Z(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Fade(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Scale_X(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Scale_Y(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_Rot_Z(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float
dim RLSmoke_RotSpeed_Z(num_smoke_stacks-1,NUM_RL_SMOKE_PARTICLES) as float

rem display settings
setup()



introduction()

begin:
center text screen width()/2,screen height()/2,"Loading Juxta Tempus..." : sync

cleanUp()



rem media,sync,ambience
loadmedia()
initialize()
skyBox()
buildTerrain()
player()
construct()
props()
textTimer()



button=createButton(1225,0,50,25,"About",0,0)
 font=createFont("Verdana",7,1,1,0)
  applyFont button,font



rem Make all the particles
rem object number for first snow object
beg_snow_num =22
rem total number of snow objects
snow_total_num =1000
rem number of rings of snow around player to create
snow_rings =4
rem max radius of snow particles
snow_range =400
rem the size of the snow plains
snow_size# =.5
rem keep up with the number of snow objects used
avail_rings =snow_total_num
rem keep up with the current range to use for each ring of snow
curr_range =snow_range
rem dim arrays to store snow data
rem store number of snow flakes in each ring
dim snow_ring_val#(snow_rings)
rem store the range of each ring
dim snow_ring_range(snow_rings)
rem store the deg offset to use in each ring for particle placement in a ring
dim snow_ring_deg#(snow_rings)
rem reset weather variable to 0
weather =0
rem set snow as on by default
snow =1
rem set up an array holding position and speed of particles
dim snow#(snow_total_num,3)
rem make variables to make code easier to read
xPos=0
yPos=1
zPos=2
speed=3
rem create snow objects and default data
gosub snowfall

Rem Load smoke image
load image "mediasmoke.jpg",1
   `Make smoke particles
   RLSmoke_BasePos_X(0) = 912.895
   RLSmoke_BasePos_Y(0) = 44
   RLSmoke_BasePos_Z(0) = 864.632
   RLSmoke_BasePos_X(1) = 923.944
   RLSmoke_BasePos_Y(1) = 33
   RLSmoke_BasePos_Z(1) = 736.48
   RLSmoke_BasePos_X(2) = 1034
   RLSmoke_BasePos_Y(2) = 30
   RLSmoke_BasePos_Z(2) = 693

for i = 0 to num_smoke_stacks-1
   tempfade =100
   tempscale =1
   tempX# = RLSmoke_BasePos_X(i)
   tempY# = RLSmoke_BasePos_Y(i)
   tempZ# = RLSmoke_BasePos_Z(i)
   for x = beg_smoke_num(i) to (NUM_RL_SMOKE_PARTICLES + beg_smoke_num(i))
      make object plain x,20,20
      texture object x,1
      set object transparency x,2
      ghost object on x
      disable object zwrite x
      set object rotation xyz x
      RLSmoke_Pos_X(i,(x-beg_smoke_num(i))) = tempX#
      RLSmoke_Pos_Y(i,(x-beg_smoke_num(i))) = tempY#
      RLSmoke_Pos_Z(i,(x-beg_smoke_num(i))) = tempZ#
      RLSmoke_Fade(i,(x-beg_smoke_num(i))) = tempfade
      RLSmoke_Scale_X(i,(x-beg_smoke_num(i))) = tempscale
      RLSmoke_Scale_Y(i,(x-beg_smoke_num(i))) = tempscale
      RLSmoke_Rot_Z(i,(x-beg_smoke_num(i))) = rnd(360)
      RLSmoke_RotSpeed_Z(i,(x-beg_smoke_num(i))) = .1
      dec tempfade, 2
      inc tempscale, 2
      inc tempX#, 0.05
      inc tempY#, 0.5
      inc tempZ#, 0.05
   next x
next i

rem setup door info locations for testing
doors =1
rem dim arrays to store inside and outside door locations
dim inside#(doors, 2)
dim outside#(doors, 2)
rem set locations
outside#(1, 0) =810
outside#(1, 1) =1
outside#(1, 2) =1315


inside#(1, 0)  =810
inside#(1, 1)  =1
inside#(1, 2)  =1325



rem make array to store building to door names
dim door_name$(doors)
door_name$(1) = ""


rem make array to store ranges to test doors with
rem added to account for wider doorways
dim door_range#(doors)
door_range#(1) =5


rem make array to tell if is a door or doorway
rem use 0 for door and 1 for doorway (no door or walk-through)
dim door_way(doors)
door_way(1) =0


do


rem update global time
update_time# =timer()

rem xyz, poly, fps display
hud()
rem right click to show/hide mouse.  click "about" to test it
mouse()


rem GUI
getEvent
  if eventSource()=Button
     if eventType()=mouse_click
        message "x1b(lawrence)'s RPG Demo 2005"
        message "Thanks to..."
        message "Lost In thought,for heavy Code help"
        message "Megaton Cat,for Models and Lighting"
        message "steve, you wanker"
     endif
  endif


rem Mouse & Camera
if upkey()=1 then move object 1,1.0
if downkey()=1 then move object 1,-1.0
if leftkey()=1 then move object left 1,1.0
if rightkey()=1 then move object right 1,1.0


camy#=camy#+mousemovex()*.1
camx#=camx#+mousemovey()*.1
if camx#>90 and camx#<135 then camx#=90
if camx#>270 and camx#<225 then camx#=90
yrotate camera camy#
xrotate camera camx#
yrotate object 1,camy#
xrotate object 1,camx#


rem simple gravity
xrotate object 1, 0
move object down 1, 1


rem jump code
if spacekey()=1 and jumping=0 and (timer()- time_now#)/1000=>time# then jump=1

rem ground height
ground# = get terrain ground height(16,object position x(1),object position z(1))+1
if object position y(1) < ground#
   position object 1,object position x(1),ground#,object position z(1)
endif

rem get number of collisions for player
countcoll =CountCollisionsPRO(1)
rem search each collision to see if one is collided
for i =1 to countcoll
   hitObj =CollisionHitObj(1,i)
   if sound playing(4)=0
      if hitObj =1 then play sound 4
      rem remove exit if we add more
      exit
   endif
next i

rem turn off jumping safety
if jumping=1
   rem if object hits or goes below ground
   if object position y(1) <= ground#
      jumping=0: y# =ground#: time_now# =timer()
   endif

rem if object hits another object
   if countcoll > 0
      jumping=0: time_now# =timer()
      y# =object position y(1)
   endif
endif

if jump=1
   jump_speed#=2
   jumping=1
   jump=0
endif

if jumping=1
   dec jump_speed#,.075
   y# = object position y(1)
   y# = y# + jump_speed#
   position object 1,object position x(1), y#,object position z(1)
endif

rem check to see if in range of door and (e)nter
for i =1 to doors
   rem make flag to store door found
   door_found =0
   rem make flag to capture the e key press
   temp_e = keystate(18)
   if temp_e =0
      e_used =0
   endif
   rem if in range, place player inside
   if range3D(1, outside#(i,0), outside#(i,1), outside#(i,2)) < door_range#(i)
      rem if e key is pressed
      if temp_e = 1
        if e_used = 0
           e_used = 1
           if door_way(i) < 1
              rem position him inside
              position object 1, inside#(i,0), inside#(i,1), inside#(i,2)
              rem reset the position in the collision system or it will slide him back out
              ResetObjPRO(1)
           endif
        endif
      endif
      rem set message to display
      door_message_num =i
      rem set timer value
      door_text_time# =update_time#
      rem set if door is found
      door_found =1
   endif
   rem don't check inside if outside found
   if door_found =1 then exit
   rem if in range, place player outside
   if range3D(1, inside#(i,0), inside#(i,1), inside#(i,2)) < door_range#(i)
      rem if e key is pressed
      if temp_e =1
        if e_used =0
           e_used =1
           if door_way(i) < 1
              rem position him outside
              position object 1, outside#(i,0), outside#(i,1), outside#(i,2)
              rem reset the position in the collision system or it will slide him back out
              ResetObjPRO(1)
           endif
        endif
      endif
      rem set message to display
      rem door_message_num =i
      rem set timer value
      door_text_time# =update_time#
      rem exit the loop as you can only be near 1 door ata time so no more testing
      rem is needed
      door_found =1
      exit
   endif
next i

rem display message when door used
if update_time# - door_text_time# < 1500
   center text screen width()/2,screen height()/2, door_name$(door_message_num)
endif


rem teh panic button(hit ctrl to "port" back to starting point if stuck in a object)
if controlkey()=1
   position object 1,225,10,1044
   ResetObjPRO(1)
endif


rem update camera to players position
position camera object position x(1), object position y(1)+7, object position z(1)

rem Enviroment Variables
rem rotate sky
yrotate object 9,wrapvalue(object angle y(9)+0.01)


rem snow walk(sound)
if upkey()=1 or downkey()=1 or leftkey()=1 or rightkey() =1
   if sound playing(2)=0
      play sound 2
endif
 else
  stop sound 2
   endif



rem update weather count
inc weather
   rem every 5000 loops randomly turn snow on or off and reset the loop count
   if weather =5000
      snow =rnd(1)
      weather =1
   endif
   rem if snow =1 show and control the snow
   if snow =1
      rem update snow
      gosub control_snow
   else
      if snowfall =1
         snowfall =0
         rem if snow not =1 then hide snow and don't control it
         gosub delete_snow
      endif
   endif


gosub Update_RLSmoke
rem update Juxta
update terrain

rem run collision system
RunCollisionPRO()
sync
loop

Update_RLSmoke:
for i = 0 to num_smoke_stacks-1
   `Update paricles (fade, scale, position and rotate them)
   for x=0 to NUM_RL_SMOKE_PARTICLES
      `If particle isn't completely faded
         dec RLSmoke_Fade(i,x), 2
         inc RLSmoke_Scale_X(i,x), 2
         inc RLSmoke_Scale_Y(i,x), .75
         dec RLSmoke_Pos_X(i,x), 0.05
         inc RLSmoke_Pos_Y(i,x), 0.5
         inc RLSmoke_Pos_Z(i,x), 0.05
         inc RLSmoke_Rot_Z(i,x), RLSmoke_RotSpeed_Z(i,x)
         if RLSmoke_Rot_Z(i,x) > 360
            RLSmoke_Rot_Z(i,x) = RLSmoke_Rot_Z(i,x)-360
         endif
         `If the particle is completely faded, reset it
         if RLSmoke_Fade(i,x) <= 0
            RLSmoke_Pos_X(i,x) = RLSmoke_BasePos_X(i)
            RLSmoke_Pos_Y(i,x) = RLSmoke_BasePos_Y(i)
            RLSmoke_Pos_Z(i,x) = RLSmoke_BasePos_Z(i)
            RLSmoke_Fade(i,x) = 100
            RLSmoke_Scale_X(i,x) = 1
            RLSmoke_Scale_Y(i,x) = 1
         endif
         fade object ((x+beg_smoke_num(i))), RLSmoke_Fade(i,x)
         scale object ((x+beg_smoke_num(i))), RLSmoke_Scale_X(i,x), RLSmoke_Scale_Y(i,x), 100
         position object ((x+beg_smoke_num(i))), RLSmoke_Pos_X(i,x), RLSmoke_Pos_Y(i,x), RLSmoke_Pos_Z(i,x)
         set object to camera orientation ((x+beg_smoke_num(i)))
         roll object right ((x+beg_smoke_num(i))), RLSmoke_Rot_Z(i,x)
   next x
next i

return

snowfall:
rem gather data for making snow
rem cycle through all rings but last one to calc data
for i = 1 to snow_rings-1
   rem update the amount of rings used
   rem each loop from max range working toward the player halves the amount left
   rem to use (bigger rings need more snow flakes)
   avail_rings =avail_rings/2
   rem save the number of flakes for each ring
   snow_ring_val#(i) =avail_rings
   rem save the range for each ring
   snow_ring_range(i) =curr_range
   rem update the range
   rem each ring halves the range as it get closer to the player starting with
   rem the max on the first ring
   curr_range =curr_range/2
   rem calc the degree offset to use based on the number of flakes in each ring
   rem formula is 360 degrees/ number of flakes
   snow_ring_deg#(i) =360.0/snow_ring_val#(i)
next i
rem use whats left over for the last ring ;-)
avail_rings = avail_rings
snow_ring_val#(i) =avail_rings
snow_ring_range(i) =curr_range
snow_ring_deg#(i) =360.0/snow_ring_val#(i)

rem now that data is gathered we can make flakes
rem make variables to keep up with the index number and object number of each flake
partnum =1
objnum =beg_snow_num
rem Make textured and ghosted plains for snow and set transparency on

rem cycle through the number of desired rings outside to inside (1 to snow_rings)
for k =1 to snow_rings
   rem make flakes based on the number of flakes per ring calced earlier
   for i =1 to int(snow_ring_val#(k))
      rem save the clock degree of each flake in relation to the player position
      new_deg =snow_ring_deg#(k)*i
      rem if the first flake then make a plain
      if objnum =beg_snow_num
         rem make a snow flake
         make object plain objnum, snow_size#, snow_size#, 1
         rem setup wire, transarency, and culling of object
         set object objnum,1,0,0
         rem texture flake
         texture object objnum,4
         rem make semi transparent
         ghost object on objnum
         rem needed for proper ghosting look
         disable object zwrite objnum
      rem for 2 to max flakes use instance object to save memory and run faster
      else
         instance object objnum, beg_snow_num
      endif
      rem Setup array values for each particles holding the positional data
      rem calc x and z pos using sin() and cos() * by range of each ring
      rem make y start position of each flake a random 50 to 100
      snow#(partnum,xPos)=object position x(1)+(sin(new_deg)*snow_ring_range(k))
      snow#(partnum,yPos)=rnd(50)+50
      snow#(partnum,zPos)=object position z(1)+(cos(new_deg)*snow_ring_range(k))
      rem make snow flakes fall at random speeds
      snow#(partnum,speed)=(rnd(3)+1): `Speed of particle
      rem Position object for start
      position object objnum, snow#(partnum,xPos), snow#(partnum,yPos), snow#(partnum,zPos)
      rem make random rotations for start
      rotate object objnum, rnd(15)-7.5, rnd(360), 0
      turn object right objnum, rnd(360)
      rem hide and let snow control show and hide snow
      hide object objnum
      rem update placement variables each loop
      inc objnum, 1
      inc partnum, 1
   next i
next k
return

control_snow:
rem update snow falling

rem make variables to keep up with the index number and object number of each flake
partnum =1
objnum =beg_snow_num
rem cycle through the number of desired rings outside to inside (1 to snow_rings)
for k =1 to snow_rings
   rem cycle though each flake
   for i =1 to int(snow_ring_val#(k))
     rem Move particle down according to speed value, which makes a random effect
     snow#(partnum,yPos)=snow#(partnum,yPos)-(snow#(partnum,speed)*.120005)
     rem If particle goes too low, set new position
     if snow#(partnum,yPos)<-20
         rem save the clock degree of each flake in relation to the player position
         new_deg = snow_ring_deg#(k)*i
         rem recalc data as we did before
         snow#(partnum,xPos)=object position x(1)+(sin(new_deg)*snow_ring_range(k))
         snow#(partnum,yPos)=rnd(50)+50
         snow#(partnum,zPos)=object position z(1)+(cos(new_deg)*snow_ring_range(k))
         snow#(partnum,speed)=(rnd(3)+1): `Speed of particle
         rem update for new rotation
         rotate object objnum, rnd(15)-7.5, rnd(360), 0
         turn object right objnum, rnd(360)
     endif
     rem Position particle with new data
     position object objnum, snow#(partnum,xPos), snow#(partnum,yPos), snow#(partnum,zPos)
     rem if snow has not been shown ... show it
     if snowfall =0
          show object objnum
     endif
     rem update placement holding vars
     inc objnum,1
     inc partnum,1
   next i
next k
rem lets you know snow has been shown
snowfall =1
return

delete_snow:
   rem hide snow and let it know it is hidden by snowfall =0
   for i = beg_snow_num to snow_total_num + beg_snow_num
      if object exist(i) =1
         hide object i
      else
         exit
      endif
   next i
return
 return


function setup()
  if check display mode(1280,1024,32)=1 then set display mode 1280,1024,32
  `set display mode 1280,1024,32
  sync rate 0
  hide mouse
  backdrop on
  color backdrop 0
  set camera range 0.5,50000
  flush video memory
endfunction


function initialize()
  sync on
   sync rate 0
  set ambient light 100
endfunction

function cleanUp()
  delete image 3
  flush video memory
  cls
endfunction

function skyBox()
  load object "skysphereskybox.x",9
  set object light 9,0
  set object texture 9,2,1
  scale object 9,50000,50000,50000
  position object 9,0,0,0
  position camera 0,0,0
endfunction


function buildTerrain()
  make object terrain 16
  set terrain heightmap 16, "mediajuxta.bmp"
  set terrain scale 16, 3, 0.8 , 3
  set terrain split 16,8
  set terrain tiling 16,128
  set terrain light 16, -50, 0.75, 0.5, 0.5, 0.7, 0.8, 0.0    `light - xdir, ydir, zdir, red, green, blue, intensity
  set terrain texture 16, 1,2
  build terrain 16
endfunction


function loadmedia()
 load image "mediasmoke.jpg",1
 load image "terrain.jpg",2
 load image "mediasnowflake.jpg",4
 load image "mediajuxta.bmp",16

 rem load music
 load 3dsound "soundsnow_walk01.wav",2:set sound volume 2,85
 load 3dsound "soundwind.wav",3:set sound volume 3,60
 rem loop wind
 loop sound 3
endfunction


function player()
rem add PC
make object sphere 1,10
 position object 1,820,29,805
   hide object 1
CollisionTypePRO(1,type_Player)
 SetObjRadiusPRO(1,2,4,2)
   SetEllipOffsetPRO(1,0,5,0)
rem player variable
jumping#=0
time#=1
endfunction

function construct()
rem add House01a
 load object "mediavillagehouse01.x",3009
  position object 3009,985,2,875
   yrotate object 3009,wrapvalue(object angle y(3009)+55)
 CollisionTypePRO(3009,type_World)
  SetObjScalePRO(3009,4,4,4)
  set object light 3009,0


rem add House01b
 load object "mediavillageHouse01.x",3010
  position object 3010,965,2,700
   yrotate object 3010,wrapvalue(object angle y(3010)+105)
 CollisionTypePRO(3010,type_World)
  SetObjScalePRO(3010,3,3,3)
  set object light 3010,0


rem add Smith
 load object "mediavillageSmith.x",3013
  position object 3013,1045,2,712
   yrotate object 3013,wrapvalue(object angle y(3013)+75)
 CollisionTypePRO(3013,type_World)
  SetObjScalePRO(3013,3,3,3)
  set object light 3013,0


rem add Tavern
 load object "mediavillageTavern.x",3014
  position object 3014,1205,2,485
   yrotate object 3014,wrapvalue(object angle y(3014)+55)
 CollisionTypePRO(3014,type_World)
  SetObjScalePRO(3014,3,3,3)
  set object light 3014,0



rem add House6
 load object "mediavillagehouse6.x",3017
  position object 3017,1230,3,890
   yrotate object 3017,wrapvalue(object angle y(3017)-32)
 CollisionTypePRO(3017,type_World)
  SetObjScalePRO(3017,3,3,3)
  set object ambient 3017,0



rem add House3
 load object "mediavillagehouse3.x",3018
  position object 3018,860,4,630
   yrotate object 3018,wrapvalue(object angle y(3018)+90)
 CollisionTypePRO(3018,type_World)
  SetObjScalePRO(3018,3,3,3)
  set object light 3018,0



rem add Cathedral
 load object "mediacathedralcathedral.x",3015
  load object "mediacathedralcathedral_lmap.x",3019
  position object 3015,1217,39,697
    position object 3019,1217,39,697
   yrotate object 3015,wrapvalue(object angle y(3015)+100)
    yrotate object 3019,wrapvalue(object angle y(3019)+100)
 CollisionTypePRO(3015,type_World)
  SetObjScalePRO(3015,4,6,4)
   SetObjScalePRO(3019,4,6,4)
   ghost object on 3019,1
   set object ambient 3019,1
  set object light 3015,0

endfunction



function props()
rem well(mid village)
 load object "mediapropswell.x",4001
  position object 4001,785,2,782
   yrotate object 4001,wrapvalue(object angle y(4001)+0)
 CollisionTypePRO(4001,type_World)
  SetObjScalePRO(4001,5,5,5)
  set object light 4001,0
endfunction



function range3D(obj1, bx#, by#, bz#)
rem test distance between an object and a 3d point
  null3D=make vector3(3)
  ax#=object position x(obj1)
  ay#=object position y(obj1)
  az#=object position z(obj1)
  set vector3 3,ax#-bx#,ay#-by#,az#-bz# : result#=length vector3(3)
  null3D=delete vector3(3)
endfunction result#



function range3Dobj(obj1, obj2)
rem test distance between 2 objects
  null3D=make vector3(3)
  ax#=object position x(obj1)
  ay#=object position y(obj1)
  az#=object position z(obj1)
  bx#=object position x(obj2)
  by#=object position y(obj2)
  bz#=object position z(obj2)
  set vector3 3,ax#-bx#,ay#-by#,az#-bz# : result#=length vector3(3)
  null3D=delete vector3(3)
endfunction result#



function hud()
  rem set cursor
  set cursor 0,0

  rem show frame rate
  print "fps: " + str$ (screen fps())
  print ""

  rem current camera position
  print "x: " + str$ (object position x(1))
  print "y: " + str$ (object position y(1))
  print "z: " + str$ (object position z(1))
  print ""

  rem polygon count
  print "polygon count: " + str$ (statistic(1))
endfunction



function f(frame,obj)
rem correct frame for DM2 animations
  fr = int(frame * (total object frames(obj)/650.0))
endfunction fr



function mouse()
rem if mousebutton 2 is clicked
if mouseclick()=2
   rem if mouse button click was scanned for the first time
   if m2pressed =0
      rem set mouse2 as scanned so it won't work again until you release it and press again
      m2pressed =1
      rem set varaible to keep up with menu on or off
      rem (mouseval =0 for game and 1 for menu)
      if mouseval =0
         mouseval =1
         show mouse
      else
         mouseval =1
         mouseval =0
         hide mouse
      endif
   endif
else
   rem set mouse2click to not clicked/scanned
   m2pressed = 0
endif
endfunction



function introduction()
rem load logo
load image "DFS.png",3
sprite 1,1,1,3

rem fade in logo
fadein =1

_fadein:

set sprite alpha 1,fadein:sleep 100
  if fadein => 0  then fadein =fadein +10
  if fadein => 250 then gosub _chant
gosub _fadein

rem chant
_chant:

wait 2000

load sound "soundchant.wav",1
play sound 1

wait 2000

rem _fadeout
fade =250

_fadeout:
 set sprite alpha 1,fade:sleep 100
  if fade => 0 then fade =fade -10
  if fade =< 0 then gosub begin
gosub _fadeout

endfunction


function textTimer()
door_text_time# = timer()-2000
endfunction