Пример #1
0
//
// R_GetHorizonPortal
//
// Either finds an existing horizon portal matching the parameters,
// or creates a new one. Used in p_spec.c.
//
portal_t *R_GetHorizonPortal(int *floorpic, int *ceilingpic, 
                             fixed_t *floorz, fixed_t *ceilingz, 
                             int16_t *floorlight, int16_t *ceilinglight, 
                             fixed_t *floorxoff, fixed_t *flooryoff, 
                             fixed_t *ceilingxoff, fixed_t *ceilingyoff,
                             float *floorbaseangle, float *floorangle,
                             float *ceilingbaseangle, float *ceilingangle)
{
   portal_t *rover, *ret;
   edefstructvar(horizondata_t, horizon);

   if(!floorpic || !ceilingpic || !floorz || !ceilingz || 
      !floorlight || !ceilinglight || !floorxoff || !flooryoff || 
      !ceilingxoff || !ceilingyoff || !floorbaseangle || !floorangle ||
      !ceilingbaseangle || !ceilingangle)
      return NULL;

   horizon.ceilinglight     = ceilinglight;
   horizon.floorlight       = floorlight;
   horizon.ceilingpic       = ceilingpic;
   horizon.floorpic         = floorpic;
   horizon.ceilingz         = ceilingz;
   horizon.floorz           = floorz;
   horizon.ceilingxoff      = ceilingxoff;
   horizon.ceilingyoff      = ceilingyoff;
   horizon.floorxoff        = floorxoff;
   horizon.flooryoff        = flooryoff;
   horizon.floorbaseangle   = floorbaseangle; // haleyjd 01/05/08
   horizon.floorangle       = floorangle;
   horizon.ceilingbaseangle = ceilingbaseangle;
   horizon.ceilingangle     = ceilingangle;

   for(rover = portals; rover; rover = rover->next)
   {
      if(rover->type != R_HORIZON || 
         memcmp(&rover->data.horizon, &horizon, sizeof(horizon)))
         continue;

      return rover;
   }

   ret = R_CreatePortal();
   ret->type = R_HORIZON;
   ret->data.horizon = horizon;
   return ret;
}
Пример #2
0
portal_t *R_GetLinkedPortal(int markerlinenum, int anchorlinenum, 
                            fixed_t planez,    int fromid,
                            int toid)
{
   portal_t *rover, *ret;
   edefstructvar(linkdata_t, ldata);

   ldata.fromid = fromid;
   ldata.toid   = toid;
   ldata.planez = planez;

   R_CalculateDeltas(markerlinenum, anchorlinenum, 
                     &ldata.deltax, &ldata.deltay, &ldata.deltaz);

   ldata.maker = markerlinenum;
   ldata.anchor = anchorlinenum;

   for(rover = portals; rover; rover = rover->next)
   {
      if(rover->type  != R_LINKED                || 
         ldata.deltax != rover->data.link.deltax ||
         ldata.deltay != rover->data.link.deltay ||
         ldata.deltaz != rover->data.link.deltaz ||
         ldata.fromid != rover->data.link.fromid ||
         ldata.toid   != rover->data.link.toid   ||
         ldata.planez != rover->data.link.planez)
         continue;

      return rover;
   }

   ret = R_CreatePortal();
   ret->type = R_LINKED;
   ret->data.link = ldata;

   // haleyjd: temporary debug
   ret->tainted = 0;

   return ret;
}
Пример #3
0
//
// HUDTextWidget::drawer
//
// Default drawing function for a text widget.
//
void HUDTextWidget::drawer()
{
   // Do not ever draw automap-only widgets if not in automap mode.
   // This fixes a long-standing bug automatically.
   if(flags & TW_AUTOMAP_ONLY && !automapactive)
      return;

   // 10/08/05: boxed message support
   if(flags & TW_BOXED)
   {
      int width, height;

      width  = V_FontStringWidth (font, message);
      height = V_FontStringHeight(font, message);

      V_DrawBox(x - 4, y - 4, width + 8, height + 8);
   }

   if(message && (!cleartic || leveltime < cleartic))
   {
      edefstructvar(vtextdraw_t, vdt);
      
      vdt.font   = font;
      vdt.s      = message;
      vdt.x      = x;
      vdt.y      = y;
      vdt.screen = &subscreen43;
      if(color)
      {
         vdt.flags       = VTXT_FIXEDCOLOR;
         vdt.fixedColNum = color - 1;
      }
      else
         vdt.flags = VTXT_NORMAL;

      V_FontWriteTextEx(vdt);
   }
}
Пример #4
0
//
// HUDMessageWidget::drawer
//
// Drawer for the player message widget.
//
void HUDMessageWidget::drawer()
{
   if(!showMessages)
      return;

   edefstructvar(vtextdraw_t, vtd);

   vtd.font        = hud_font;
   vtd.screen      = &subscreen43;
   vtd.flags       = VTXT_FIXEDCOLOR;
   vtd.fixedColNum = mess_colour;
   
   // go down a bit if chat active
   vtd.y = chat_active ? hud_font->absh : 0;
   
   for(int i = 0; i < current_messages; i++)
   {
      char *msg = messages[i];
      
      // haleyjd 12/26/02: center messages in proper gamemodes
      // haleyjd 08/26/12: center also if in widescreen modes
      if(GameModeInfo->flags & GIF_CENTERHUDMSG || 
         vbscreen.getVirtualAspectRatio() > 4 * FRACUNIT / 3)
      {
         vtd.x = (SCREENWIDTH - V_FontStringWidth(hud_font, msg)) / 2;
         vtd.flags |= VTXT_ABSCENTER;
      }
      else
         vtd.x = 0;
      
      vtd.s = msg;

      V_FontWriteTextEx(vtd);

      vtd.y += V_FontStringHeight(hud_font, msg);
   }
}