View Single Post
  #7  
Old 08-19-2016, 07:15 AM
Gunderak Gunderak is offline
Coder
Gunderak's Avatar
Join Date: Jun 2011
Location: Australia
Posts: 795
Gunderak is on a distinguished road


Managed to implement the way the floors are done in Doom etc but since I can't access the image buffer it's wayyyyyy too slow to actually render a 1x1 pixel graphic for the floor and ceiling data, so for now just using a solid image.


Here is my floor logic if anyone has any ideas on how to make it not laggy, maybe I'm doing it a dumb way, not sure:

PHP Code:
    temp.floorxwall = 0;
    
temp.floorywall = 0;
    if(
temp.side == 0 && temp.raydirx > 0){
      
temp.floorxwall = temp.mapx;
      
temp.floorywall = temp.mapy + temp.wallx;
    }else if(
temp.side == 0 && temp.raydirx < 0){
      
temp.floorxwall = temp.mapx + 1;
      
temp.floorywall = temp.mapy + temp.wallx;
    }else if(
temp.side == 1 && temp.raydiry > 0){
      
temp.floorxwall = temp.mapx + temp.wallx;
      
temp.floorywall = temp.mapy;
    }else{
      
temp.floorxwall = temp.mapx + temp.wallx;
      
temp.floorywall = temp.mapy + 1;
    }
    
temp.distwall = temp.perpwalldist;
    
temp.distplayer = 0;
    if(
temp.drawend < 0){
      
temp.drawend = this.h;
    }
    for(
temp.y = temp.drawend; temp.y < this.h; temp.y ++){
      
temp.currentdist = this.h/(2 * temp.y - this.h);
      
temp.weight = (temp.currentdist)/(temp.distwall);
      
temp.currentfloorx = temp.weight*temp.floorxwall + (1 - temp.weight) * this.posx;
      
temp.currentfloory = temp.weight*temp.floorywall + (1 - temp.weight) * this.posy;
      
temp.floortexx = int(temp.currentfloorx*this.texturewidth)%this.texturewidth;
      
temp.floortexy = int(temp.currentfloory*this.texturewidth)%this.texturewidth;
      
Gunderak_3D.drawimagestretched(temp.x, temp.y, 1, 1, "wolftextures.png", temp.floortexx+(64*6), temp.floortexy, 1, 1);
    } 

I mean, it works, but like 0.00005 FPS lol.
__________________

Gund for president.

Remote PM {P*}x (Graal813044) from eraiphone -> Stefan: I hav 1 qustion
*Gunderak: he hav 1
*Gunderak: qustion

Last edited by Gunderak; 08-19-2016 at 10:35 AM..
Reply With Quote