Difference for arch/ogl/ogl.c from version 1.3 to 1.4


version 1.3 version 1.4
Line 15
 
Line 15
 #include "textures.h"  #include "textures.h"
 #include "texmerge.h"  #include "texmerge.h"
 #include "effects.h"  #include "effects.h"
   #include "weapon.h"
   #include "powerup.h"
   #include "polyobj.h"
   
 //crude texture precaching  //crude texture precaching
 //handles: powerups, walls, etc.  //handles: powerups, walls, weapons, polymodels, etc.
 //it is done with the horrid do_special_effects kludge so that sides that have to be texmerged and have animated textures will be correctly cached.  //it is done with the horrid do_special_effects kludge so that sides that have to be texmerged and have animated textures will be correctly cached.
 //should add : weapons/doors/polymodel-textures  //similarly, with the objects(esp weapons), we could just go through and cache em all instead, but that would get ones that might not even be on the level
   //TODO: doors
   
   void ogl_cache_polymodel_textures(int model_num){
    polymodel *po=&Polygon_models[model_num];
    int i;
    for (i=0;i<po->n_textures;i++)  {
   // texture_list_index[i] = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]];
    ogl_loadbmtexture(&GameBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index]);
    }
   }
   void ogl_cache_vclip_textures(vclip *vc){
    int i;
    for (i=0;i<vc->num_frames;i++){
    PIGGY_PAGE_IN(vc->frames[i]);
    ogl_loadbmtexture(&GameBitmaps[vc->frames[i].index]);
    }
   }
   #define ogl_cache_vclipn_textures(i) ogl_cache_vclip_textures(&Vclip[i])
   void ogl_cache_weapon_textures(weapon_info *w){
    ogl_cache_vclipn_textures(w->flash_vclip);
    ogl_cache_vclipn_textures(w->robot_hit_vclip);
    ogl_cache_vclipn_textures(w->wall_hit_vclip);
    if (w->render_type==WEAPON_RENDER_VCLIP)
    ogl_cache_vclipn_textures(w->weapon_vclip);
    else if (w->render_type==WEAPON_RENDER_POLYMODEL)
    ogl_cache_polymodel_textures(w->model_num);
   }
 void ogl_cache_level_textures(void){  void ogl_cache_level_textures(void){
  int seg,side,i;   int seg,side,i;
  eclip *ec;   eclip *ec;
  vclip *vc;  
  short tmap1,tmap2;   short tmap1,tmap2;
  grs_bitmap *bm;   grs_bitmap *bm;
  struct side *sidep;   struct side *sidep;
Line 72
 
Line 100
  }   }
  reset_special_effects();   reset_special_effects();
  init_special_effects();   init_special_effects();
    {
   // int laserlev=1;
    //always have lasers and concs
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[LASER_INDEX]]);
    ogl_cache_weapon_textures(&Weapon_info[Secondary_weapon_to_weapon_info[CONCUSSION_INDEX]]);
  for (i=0;i<Highest_object_index;i++){   for (i=0;i<Highest_object_index;i++){
  if(Objects[i].render_type==RT_POWERUP){   if(Objects[i].render_type==RT_POWERUP){
  vc=&Vclip[Objects[i].rtype.vclip_info.vclip_num];   ogl_cache_vclipn_textures(Objects[i].rtype.vclip_info.vclip_num);
  for (seg=0;seg<vc->num_frames;seg++){   switch (Objects[i].id){
  PIGGY_PAGE_IN(vc->frames[seg]);  /* case POW_LASER:
  bm=&GameBitmaps[vc->frames[seg].index];   ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[LASER_INDEX]]);
  ogl_loadbmtexture(bm);  // if (laserlev<4)
   // laserlev++;
    break;*/
    case POW_VULCAN_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[VULCAN_INDEX]]);
    break;
    case POW_SPREADFIRE_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[SPREADFIRE_INDEX]]);
    break;
    case POW_PLASMA_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[PLASMA_INDEX]]);
    break;
    case POW_FUSION_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[FUSION_INDEX]]);
    break;
   /* case POW_MISSILE_1:
    case POW_MISSILE_4:
    ogl_cache_weapon_textures(&Weapon_info[Secondary_weapon_to_weapon_info[CONCUSSION_INDEX]]);
    break;*/
    case POW_PROXIMITY_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Secondary_weapon_to_weapon_info[PROXIMITY_INDEX]]);
    break;
    case POW_HOMING_AMMO_1:
    case POW_HOMING_AMMO_4:
    ogl_cache_weapon_textures(&Weapon_info[Primary_weapon_to_weapon_info[HOMING_INDEX]]);
    break;
    case POW_SMARTBOMB_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Secondary_weapon_to_weapon_info[SMART_INDEX]]);
    break;
    case POW_MEGA_WEAPON:
    ogl_cache_weapon_textures(&Weapon_info[Secondary_weapon_to_weapon_info[MEGA_INDEX]]);
    break;
  }   }
  //possibly add in caching of the weapon firing bitmaps for all weapons in levels?  
  }   }
  else if(Objects[i].render_type==RT_POLYOBJ){   else if(Objects[i].render_type==RT_POLYOBJ){
    ogl_cache_polymodel_textures(Objects[i].rtype.pobj_info.model_num);
  //cache its textures...   //cache its textures...
  }   }
  }   }
    }
  mprintf((0,"finished caching\n"));   mprintf((0,"finished caching\n"));
 }  }
   
 GLfloat tempmatrix[16];  
 int r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc;  int r_polyc,r_tpolyc,r_bitmapc,r_ubitmapc;
 int r_texcount=0;  int r_texcount=0;
 #define f2glf(x) (f2fl(x))  #define f2glf(x) (f2fl(x))
Line 265
 
Line 329
   
 vms_vector aoeupos={0,0,-1000*f1_0};  vms_vector aoeupos={0,0,-1000*f1_0};
 vms_matrix aoeuorient=IDENTITY_MATRIX;  vms_matrix aoeuorient=IDENTITY_MATRIX;
 //int blag=0;  
 void ogl_start_frame(void){  void ogl_start_frame(void){
 /* if (blag==0){  
  ogl_cache_level_textures();  
  blag=1;  
  }*/  
  r_polyc=0;r_tpolyc=0;r_bitmapc=0;r_ubitmapc=0;   r_polyc=0;r_tpolyc=0;r_bitmapc=0;r_ubitmapc=0;
  glClearColor(0.0, 0.0, 0.0, 0.0);   glClearColor(0.0, 0.0, 0.0, 0.0);
 // glEnable(GL_ALPHA_TEST);  // glEnable(GL_ALPHA_TEST);

Legend:
line(s) removed in v.1.3 
line(s) changed
 line(s) added in v.1.4