Advertisement
ZoriaRPG

ZScript 3D Portal

May 13th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.05 KB | None | 0 0
  1. const int SCREEN_CENTRE_X = 128;
  2.         const int SCREEN_CENTRE_Y = 88;
  3.         const int CUBE_TEXT_TIMER_DUR = 200;
  4.  
  5. ffc script portal{
  6.     void run(int bitty, int cubetimer, int modulus, int textime){
  7.        
  8.         int cube[12]={SCREEN_CENTRE_X+30,SCREEN_CENTRE_Y+30, 1,  
  9.             SCREEN_CENTRE_X+30,SCREEN_CENTRE_Y-30, 1,
  10.             SCREEN_CENTRE_X-30,SCREEN_CENTRE_Y-30, 1,
  11.             SCREEN_CENTRE_X-30,SCREEN_CENTRE_Y+30, 1};
  12.            
  13.         int cube_uv[8]={0,0, 31,0, 31, 31, 31, 0}; //Texture coordinates.
  14.         //How mdo these work?
  15.         //!
  16.        
  17.         int cube_csets[4]={0,0,0,0}; //Csets
  18.        
  19.         int textures[10]; //Holds textures.
  20.         int tex_state; //Which texture to use this frame.
  21.        
  22.         int cube_tex[2]={2,2}; //Texture size.
  23.        
  24.         //Draw each half of the aperature, using DrawTile, and slowly move them to open.
  25.        
  26.         int aperature_left_x; int aperature_right_x;
  27.         int aperature_timer;
  28.         int cube_rot_timer;
  29.         if ( modulus <= 0 ) modulus = 30;
  30.        
  31.         if ( cubetimer <= 0 ) cubetimer = 60000;
  32.         cube_rot_timer = cubetimer;
  33.        
  34.         if ( textime <= 0 ) textime = CUBE_TEXT_TIMER_DUR;
  35.        
  36.         while(aperature_timer--){
  37.            
  38.             //DrawTile(left side)
  39.                 //Move it left to open it
  40.            
  41.             //DrawTile(right side)
  42.                 //move it right to open it
  43.             Waitframe();
  44.            
  45.         }
  46.         bool waiting = true;
  47.         while(aperature_timer <= 0 ){
  48.             if ( cube_rot_timer <= 0 ) {
  49.                 //Reset the timer for cube rotation base don if D1 was set.
  50.                 if ( cubetimer ) cube_rot_timer= 60000;
  51.                 else cube_rot_timer = cubetimer;
  52.             }
  53.             cube_timer--; //A monulus of this determines if we rotate the cube this frame.
  54.             //the aperature has opened.
  55.             //Draw both halves of the aperature in an open state.
  56.            
  57.             //Handle texture change timer.
  58.            
  59.             if ( textime > 0 ) { textime--; } //Tick off the texture timer.
  60.            
  61.             else {      //The timer has elapsed.
  62.                 if ( this->InitD[3] <= 0 ) textime = CUBE_TEXT_TIMER_DUR;
  63.                 else textime = this->InitD[3];
  64.  
  65.                 //Advance the array texture.
  66.                
  67.                 if ( tex_state < 10 ) { tex_state++; }
  68.                 else tex_state = 0; //Wrap to index 0.
  69.             }
  70.            
  71.            
  72.             //DrawTile(left side)
  73.             //DrawTile(right side)
  74.            
  75.             //Decide if we rotate the cube:
  76.            
  77.             if ( cube_rot_timer != cubetimer && cube_rot_timer % modulus == 0 ) {
  78.                 //if this is not the initial frame, check if the rotation
  79.                 //timer modulus. Defualt move every 30 frames.
  80.                
  81.                 //Do rotational effect to cube[]
  82.             }
  83.            
  84.             //Draw the cube.
  85.            
  86.             Screen->Quad3D(3,cube,cube_uv, cube_csets,cube_tex, 0, textures[tex_state], 0);
  87.        
  88.            
  89.             Waitframe();
  90.  
  91.            
  92.         }
  93.     }
  94.     void __RotateQuad3D_X(int angle, int pos} {
  95.         //int cx, int cy, int cz){
  96.         for(int i=0; i<3; i++){
  97.             int y = pos[(i*3)+1];
  98.             int z = pos[(i*3)+2];
  99.            
  100.             pos[(i*3)+1] = y * Cos(angle) - z * Sin(angle);
  101.             pos[(i*3)+2] = z * Cos(angle) + y * Sin(angle);
  102.         }
  103.     }
  104. }
  105.  
  106.  
  107. /*
  108.            
  109.         //Find a free bitmap to use
  110.        
  111.         //We want a circle of shimmering blue and white
  112.        
  113.         //We want some tiles copies to it
  114.        
  115.         //We need to make the area around it translucent.
  116.        
  117.         //Triangle 3D might do better?
  118.        
  119.         //Or a cube?
  120.        
  121.        
  122.    
  123. */r
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement