Beispiel #1
0
void ScoreTableDrawCoop ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cvFont = MEDIUM3_FONT;
GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY", NULL);
grdCurCanv->cvFont = SMALL_FONT;
MultiGetKillList (sorted);
ScoreTableDrawCoopNames (sorted);
for (i=0; i<gameData.multiplayer.nPlayers; i++) {
	color = sorted [i];
	if (gameData.multiplayer.players [sorted [i]].connected==0)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (playerColors  [color].r, playerColors  [color].g, playerColors [color].b), 1, 0, 0);
	ScoreTableDrawCoopItem (i, sorted);
	}
ScoreTableDrawDeaths (sorted);
WIN (DDGRUNLOCK (dd_grd_curcanv));
WINDOS (
	DDGrSetCurrentCanvas (NULL),
	GrSetCurrentCanvas (NULL)
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (pa_set_backbuffer_current ());
GrPaletteStepLoad (NULL);
GrUpdate (0);
}
Beispiel #2
0
//draws the given model in the current canvas.  The distance is set to
//more-or-less fill the canvas.  Note that this routine actually renders
//into an off-screen canvas that it creates, then copies to the current
//canvas.
void draw_model_picture(int mn,vms_angvec *orient_angles)
{
	vms_vector	temp_pos=ZERO_VECTOR;
	vms_matrix	temp_orient = IDENTITY_MATRIX;
	grs_canvas	*save_canv = grd_curcanv,*temp_canv;

	Assert(mn>=0 && mn<N_polygon_models);

	temp_canv = gr_create_canvas(save_canv->cv_bitmap.bm_w,save_canv->cv_bitmap.bm_h);
	gr_set_current_canvas(temp_canv);
	gr_clear_canvas( BM_XRGB(0,0,0) );

	g3_start_frame();
	g3_set_view_matrix(&temp_pos,&temp_orient,0x9000);

	if (Polygon_models[mn].rad != 0)
		temp_pos.z = fixmuldiv(DEFAULT_VIEW_DIST,Polygon_models[mn].rad,BASE_MODEL_SIZE);
	else
		temp_pos.z = DEFAULT_VIEW_DIST;

	vm_angles_2_matrix(&temp_orient, orient_angles);

	PA_DFX(save_light = Lighting_on);
	PA_DFX(Lighting_on = 0);
	draw_polygon_model(&temp_pos,&temp_orient,NULL,mn,0,f1_0,NULL,NULL);
	PA_DFX (Lighting_on = save_light);

	gr_set_current_canvas(save_canv);

	gr_bitmap(0,0,&temp_canv->cv_bitmap);

	gr_free_canvas(temp_canv);
}
Beispiel #3
0
Datei: hud.c Projekt: paud/d2x-xl
void ClearBackgroundMessages (void)
{
	#ifdef WINDOWS
if (bExtraClear == gameData.app.nFrameCount) 		//don't do extra clear on same frame
	return;
	#endif

#ifdef WINDOWS
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (dd_VR_render_sub_buffer [0].yoff >= 6)) {
	dd_grs_canvas *canv_save = dd_grd_curcanv;
#else
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (VR_render_sub_buffer [0].cv_bitmap.bm_props.y >= 6)) {
	grs_canvas	*canv_save = grdCurCanv;
#endif

WINDOS (
	DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
	GrSetCurrentCanvas (GetCurrentGameScreen ())
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cv_bitmap.bm_props.w, nLastMsgYCrd+nLastMsgHeight-1));
PA_DFX (pa_set_backbuffer_current ());
copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cv_bitmap.bm_props.w, nLastMsgYCrd+nLastMsgHeight-1);
WINDOS (
	DDGrSetCurrentCanvas (canv_save),
	GrSetCurrentCanvas (canv_save)
	);
#ifdef WINDOWS
	if (bExtraClear || !GRMODEINFO (modex)) {
		bExtraClear = 0;
		nLastMsgYCrd = -1;
		}
	else
		bExtraClear = gameData.app.nFrameCount;
#else
	nLastMsgYCrd = -1;
#endif
	}
szDisplayedBackgroundMsg [nVRCurrentPage][0] = 0;
}

//	-----------------------------------------------------------------------------

void HUDClearMessages ()
{
	int i, j;
	tHUDMessage	*pMsgs;

for (j = 2, pMsgs = gameData.hud.msgs; j; j--, pMsgs++) {
	pMsgs->nMessages = 0;
	pMsgs->nFirst = 
	pMsgs->nLast = 0;
	pMsgs->xTimer = 0;
	ClearBackgroundMessages ();
	for (i = 0; i < HUD_MAX_MSGS; i++)
		sprintf (pMsgs->szMsgs [i], TXT_SLAGEL);
	}
}
Beispiel #4
0
void kmatrix_redraw ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

xOffs = (grdCurCanv->cv_bitmap.bm_props.w - 640) / 2;
yOffs = (grdCurCanv->cv_bitmap.bm_props.h - 480) / 2;
if (xOffs < 0)
	xOffs = 0;
if (yOffs < 0)
	yOffs = 0;
if (gameData.app.nGameMode & GM_MULTI_COOP) {
	kmatrix_redraw_coop ();
	return;
	}
MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cv_font = MEDIUM3_FONT;
GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE	);
grdCurCanv->cv_font = SMALL_FONT;
MultiGetKillList (sorted);
kmatrix_draw_names (sorted);
for (i=0; i<gameData.multi.nPlayers; i++) {
	if (gameData.app.nGameMode & GM_TEAM)
		color = GetTeam (sorted [i]);
	else
		color = sorted [i];
	if (gameData.multi.players [sorted [i]].connected==0)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (player_rgb  [color].r, player_rgb  [color].g, player_rgb [color].b), 1, 0, 0);
	kmatrix_draw_item (i, sorted);
	}
kmatrix_draw_deaths (sorted);
#if defined (POLY_ACC)
pa_save_clut ();
pa_update_clut (grPalette, 0, 256, 0);
#endif
PA_DFX (pa_set_frontbuffer_current ());
GrUpdate (0);
PA_DFX (pa_set_backbuffer_current ());
#if defined (POLY_ACC)
pa_restore_clut ();
#endif
WIN (DDGRUNLOCK (dd_grd_curcanv));
GrPaletteStepLoad (NULL);
}
Beispiel #5
0
Datei: hud.c Projekt: paud/d2x-xl
void ClearBackgroundMessages (void)
{
if (( (gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (nLastMsgYCrd != -1) && (gameStates.render.vr.buffers.subRender [0].cvBitmap.bmProps.y >= 6)) {
	gsrCanvas	*canv_save = grdCurCanv;

WINDOS (
	DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
	GrSetCurrentCanvas (GetCurrentGameScreen ())
	);
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cvBitmap.bmProps.w, nLastMsgYCrd+nLastMsgHeight-1));
PA_DFX (pa_set_backbuffer_current ());
copy_background_rect (0, nLastMsgYCrd, grdCurCanv->cvBitmap.bmProps.w, nLastMsgYCrd+nLastMsgHeight-1);
WINDOS (
	DDGrSetCurrentCanvas (canv_save),
	GrSetCurrentCanvas (canv_save)
	);
	nLastMsgYCrd = -1;
	}
szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage][0] = 0;
}
Beispiel #6
0
void ScoreTableRedraw ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

xOffs = (grdCurCanv->cvBitmap.bmProps.w - 640) / 2;
yOffs = (grdCurCanv->cvBitmap.bmProps.h - 480) / 2;
if (xOffs < 0)
	xOffs = 0;
if (yOffs < 0)
	yOffs = 0;
if (gameData.app.nGameMode & GM_MULTI_COOP) {
	ScoreTableDrawCoop ();
	return;
	}
MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cvFont = MEDIUM3_FONT;
GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE, NULL);
grdCurCanv->cvFont = SMALL_FONT;
MultiGetKillList (sorted);
ScoreTableDrawNames (sorted);
for (i=0; i<gameData.multiplayer.nPlayers; i++) {
	if (gameData.app.nGameMode & GM_TEAM)
		color = GetTeam (sorted [i]);
	else
		color = sorted [i];
	if (!gameData.multiplayer.players [sorted [i]].connected)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (playerColors  [color].r, playerColors  [color].g, playerColors [color].b), 1, 0, 0);
	ScoreTableDrawItem (i, sorted);
	}
ScoreTableDrawDeaths (sorted);
PA_DFX (pa_set_frontbuffer_current ());
GrUpdate (0);
PA_DFX (pa_set_backbuffer_current ());
WIN (DDGRUNLOCK (dd_grd_curcanv));
GrPaletteStepLoad (NULL);
}
Beispiel #7
0
void ShowEscortMenu(char *msg)
{	
	int	w,h,aw;
	int	x,y;
	bkg	bg;

	memset (&bg, 0, sizeof (bg));
	bg.bIgnoreBg = 1;

	WINDOS(
		DDGrSetCurrentCanvas(&dd_VR_screen_pages[0]),
		GrSetCurrentCanvas(&VR_screen_pages[0])
	);

	GrSetCurFont( GAME_FONT );
	GrGetStringSize(msg,&w,&h,&aw);
	x = (grdCurScreen->sc_w-w)/2;
	y = (grdCurScreen->sc_h-h)/4;
	GrSetFontColorRGBi (RGBA (0, PAL2RGBA (28), 0, 255), 1, 0, 0);
   PA_DFX (pa_set_frontbuffer_current());
	PA_DFX (NMDrawBackground(x-15,y-15,x+w+15-1,y+h+15-1));
   PA_DFX (pa_set_backbuffer_current());
   NMDrawBackground(NULL,x-15,y-15,x+w+15-1,y+h+15-1);
WIN(DDGRLOCK(dd_grd_curcanv));
	PA_DFX (pa_set_frontbuffer_current());
  	PA_DFX (GrUString( x, y, msg ));
	PA_DFX (pa_set_backbuffer_current());
  	GrUString( x, y, msg );
WIN(DDGRUNLOCK(dd_grd_curcanv));
	ResetCockpit();
}
Beispiel #8
0
void kmatrix_redraw_coop ()
{
	int i, color;
	int sorted [MAX_NUM_NET_PLAYERS];

MultiSortKillList ();
WIN (DDGRLOCK (dd_grd_curcanv));
grdCurCanv->cv_font = MEDIUM3_FONT;
GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY"	);
grdCurCanv->cv_font = SMALL_FONT;
MultiGetKillList (sorted);
kmatrix_draw_coop_names (sorted);
for (i=0; i<gameData.multi.nPlayers; i++) {
	color = sorted [i];
	if (gameData.multi.players [sorted [i]].connected==0)
		GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0);
	else
		GrSetFontColorRGBi (RGBA_PAL2 (player_rgb  [color].r, player_rgb  [color].g, player_rgb [color].b), 1, 0, 0);
	kmatrix_draw_coop_item (i, sorted);
	}
kmatrix_draw_deaths (sorted);
WIN (DDGRUNLOCK (dd_grd_curcanv));
WINDOS (
	DDGrSetCurrentCanvas (NULL),
	GrSetCurrentCanvas (NULL)
	);
#if defined (POLY_ACC)
pa_save_clut ();
pa_update_clut (grPalette, 0, 256, 0);
#endif
PA_DFX (pa_set_frontbuffer_current ());
PA_DFX (pa_set_backbuffer_current ());
#if defined (POLY_ACC)
pa_restore_clut ();
#endif
GrPaletteStepLoad (NULL);
GrUpdate (0);
}
Beispiel #9
0
void DrawModelPicture (int mn, vms_angvec *orient_angles)
{
    vms_vector	temp_pos=ZERO_VECTOR;
    vms_matrix	temp_orient = IDENTITY_MATRIX;
#if TEMP_CANV
    grs_canvas	*save_canv = grdCurCanv, *temp_canv;
#endif
    Assert (mn>=0 && mn<gameData.models.nPolyModels);
#if TEMP_CANV
    temp_canv = GrCreateCanvas (save_canv->cv_bitmap.bm_props.w, save_canv->cv_bitmap.bm_props.h);
    temp_canv->cv_bitmap.bm_props.x = grdCurCanv->cv_bitmap.bm_props.x;
    temp_canv->cv_bitmap.bm_props.y = grdCurCanv->cv_bitmap.bm_props.y;
    GrSetCurrentCanvas (temp_canv);
#endif
    GrClearCanvas (0);
    G3StartFrame (1, 0);
    glDisable (GL_BLEND);
    G3SetViewMatrix (&temp_pos, &temp_orient, 0x9000);
    if (gameData.models.polyModels [mn].rad != 0)
        temp_pos.z = FixMulDiv (DEFAULT_VIEW_DIST, gameData.models.polyModels [mn].rad, BASE_MODEL_SIZE);
    else
        temp_pos.z = DEFAULT_VIEW_DIST;
    VmAngles2Matrix (&temp_orient, orient_angles);
    PA_DFX (save_light = gameStates.render.nLighting);
    PA_DFX (gameStates.render.nLighting = 0);
    DrawPolygonModel (NULL, &temp_pos, &temp_orient, NULL, mn, 0, f1_0, NULL, NULL, NULL);
    PA_DFX (gameStates.render.nLighting = save_light);
#if TEMP_CANV
    GrSetCurrentCanvas (save_canv);
    glDisable (GL_BLEND);
    GrBitmap (0, 0, &temp_canv->cv_bitmap);
    glEnable (GL_BLEND);
    GrFreeCanvas (temp_canv);
#endif
    G3EndFrame ();
    if (curDrawBuffer != GL_BACK)
        GrUpdate (0);
}
Beispiel #10
0
Datei: hud.c Projekt: paud/d2x-xl
void HUDRenderMessages (ubyte nType)
{
	int			h, i, n, w, y, aw, yStart, nMsg;
	char			*pszMsg;
	tHUDMessage *pMsgs = gameData.hud.msgs + nType;

if ((pMsgs->nMessages < 0) || (pMsgs->nMessages > HUD_MAX_MSGS))
	Int3 (); // Get Rob!
if ((pMsgs->nMessages < 1) && (nModexHUDMsgs == 0))
	return;
pMsgs->xTimer -= gameData.time.xFrame;
if ( pMsgs->xTimer < 0)	{
	// Timer expired... get rid of oldest pszMsg...
	if (pMsgs->nLast != pMsgs->nFirst)	{
		int	temp;

		//&pMsgs->szMsgs.szMsg [pMsgs->nFirst][0] is deing deleted...;
		pMsgs->nFirst = (pMsgs->nFirst + 1) % HUD_MAX_MSGS;
		pMsgs->xTimer = F1_0*2;
		if (!--pMsgs->nMessages)
			nModexHUDMsgs = 2;
		temp = nLastMsgYCrd;
		ClearBackgroundMessages ();			//	If in status bar mode and no messages, then erase.
		if (nModexHUDMsgs)
			nLastMsgYCrd = temp;
	}
}

if (pMsgs->nMessages > 0) {
	if (pMsgs->nColor == -1)
		pMsgs->nColor = GREEN_RGBA;

	if ((gameStates.render.vr.nRenderMode == VR_NONE) && ((gameStates.render.cockpit.nMode == CM_STATUS_BAR) || 
		 (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (gameStates.render.vr.buffers.subRender [0].cvBitmap.bmProps.y >= (gameData.render.window.hMax/8))) {
		// Only display the most recent pszMsg in this mode
		nMsg = (pMsgs->nFirst + pMsgs->nMessages-1) % HUD_MAX_MSGS;
		pszMsg = pMsgs->szMsgs [nMsg];

		if (strcmp (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg)) {
			int	ycrd;
			WINDOS (
				ddgrs_canvas *canv_save = dd_grd_curcanv,
				gsrCanvas	*canv_save = grdCurCanv
				);
			WINDOS (
				ycrd = dd_grd_curcanv->yoff - (SMALL_FONT->ftHeight+2),
				ycrd = grdCurCanv->cvBitmap.bmProps.y - (SMALL_FONT->ftHeight+2)
				);
			if (ycrd < 0)
				ycrd = 0;
			WINDOS (
				DDGrSetCurrentCanvas (GetCurrentGameScreen ()),
				GrSetCurrentCanvas (GetCurrentGameScreen ())
				);
			GrSetCurFont (SMALL_FONT);
			GrGetStringSize (pszMsg, &w, &h, &aw);
			ClearBackgroundMessages ();
			if (grdCurCanv->cvBitmap.bmProps.nType == BM_MODEX) {
				WIN (Int3 ());    // No no no no ....
				ycrd -= h;
				h *= 2;
				HUDModexMessage ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg, SMALL_FONT, 
									  pMsgs->nColor);
				if (nModexHUDMsgs > 0) {
					nModexHUDMsgs--;
					szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage][0] = '!';
					}
				else
					strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg);
				}
			else {
				WIN (DDGRLOCK (dd_grd_curcanv));
					if (pMsgs->nColor == -1)
						pMsgs->nColor = GREEN_RGBA;
					GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0);
					PA_DFX (pa_set_frontbuffer_current ());
					PA_DFX (GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg));
					PA_DFX (pa_set_backbuffer_current ());
					GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg);
					strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg);
				WIN (DDGRUNLOCK (dd_grd_curcanv));
				}
			WINDOS (
				DDGrSetCurrentCanvas (canv_save),
				GrSetCurrentCanvas (canv_save)
				);
			nLastMsgYCrd = ycrd;
			nLastMsgHeight = h;
			}
		} 
	else {
		GrSetCurFont ( SMALL_FONT);
		if ((gameStates.render.cockpit.nMode == CM_FULL_SCREEN) || 
			 (gameStates.render.cockpit.nMode == CM_LETTERBOX)) {
			if (gameData.render.window.w == gameData.render.window.wMax)
				yStart = SMALL_FONT->ftHeight / 2;
			else
				yStart= SMALL_FONT->ftHeight * 2;
		} else
			yStart = SMALL_FONT->ftHeight / 2;
		if (gameOpts->render.cockpit.bGuidedInMainView) {
			tObject *gmP = gameData.objs.guidedMissile [gameData.multiplayer.nLocalPlayer];
			if (gmP && 
				 (gmP->nType == OBJ_WEAPON) && 
				 (gmP->id == GUIDEDMSL_ID) &&
			    (gmP->nSignature == gameData.objs.guidedMissileSig [gameData.multiplayer.nLocalPlayer]))
				yStart += SMALL_FONT->ftHeight + 3;
			}

	WIN (DDGRLOCK (dd_grd_curcanv));
		for (i = 0, y = yStart; i < pMsgs->nMessages; i++)	{
			n = (pMsgs->nFirst + i) % HUD_MAX_MSGS;
			if ((n < 0) || (n >= HUD_MAX_MSGS))
				Int3 (); // Get Rob!!
			if (!strcmp (pMsgs->szMsgs [n], "This is a bug."))
				Int3 (); // Get Rob!!
			GrGetStringSize (pMsgs->szMsgs [n], &w, &h, &aw);
			GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0);
			PA_DFX (pa_set_frontbuffer_current ());
			y = yStart + i * (h + 1);
			if (nType)
				y += ((2 * HUD_MAX_MSGS - 1) * (h + 1)) / 2;
			PA_DFX (GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y [nType], pMsgs->szMsgs [n]));
			PA_DFX (pa_set_backbuffer_current ());
			GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y, pMsgs->szMsgs [n]);
			if (!gameOpts->render.cockpit.bSplitHUDMsgs) 
				y += h + 1;
			}
		WIN (DDGRUNLOCK (dd_grd_curcanv));
		}
	}
else if (GetCurrentGameScreen ()->cvBitmap.bmProps.nType == BM_MODEX) {
	if (nModexHUDMsgs) {
		int temp = nLastMsgYCrd;
		nModexHUDMsgs--;
		ClearBackgroundMessages ();			//	If in status bar mode and no messages, then erase.
		nLastMsgYCrd = temp;
		}
	}
GrSetCurFont ( GAME_FONT);
}
Beispiel #11
0
void draw_polygon_model(vms_vector *pos,vms_matrix *orient,vms_angvec *anim_angles,int model_num,int flags,fix light,fix *glow_values,bitmap_index alt_textures[])
{
	polymodel *po;
	int i;
	PA_DFX (int save_light);

	Assert(model_num < N_polygon_models);

	po=&Polygon_models[model_num];

	//check if should use simple model
	if (po->simpler_model )					//must have a simpler model
		if (flags==0)							//can't switch if this is debris
			//!!if (!alt_textures) {				//alternate textures might not match
			//alt textures might not match, but in the one case we're using this
			//for on 11/14/94, they do match.  So we leave it in.
			{
				int cnt=1;
				fix depth;
	
				depth = g3_calc_point_depth(pos);		//gets 3d depth

				while (po->simpler_model && depth > cnt++ * Simple_model_threshhold_scale * po->rad)
					po = &Polygon_models[po->simpler_model-1];
			}

	if (alt_textures)
   {
		for (i=0;i<po->n_textures;i++)	{
			texture_list_index[i] = alt_textures[i];
			texture_list[i] = &GameBitmaps[alt_textures[i].index];

         #ifdef _3DFX
         texture_list[i]->bm_handle = texture_list_index[i].index;
         #endif
		}
   }
	else
   {
		for (i=0;i<po->n_textures;i++)	{
			texture_list_index[i] = ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]];
			texture_list[i] = &GameBitmaps[ObjBitmaps[ObjBitmapPtrs[po->first_texture+i]].index];

         #ifdef _3DFX
         texture_list[i]->bm_handle = texture_list_index[i].index;
         #endif
		}
   }

#ifdef PIGGY_USE_PAGING
	// Make sure the textures for this object are paged in...
	piggy_page_flushed = 0;
	for (i=0;i<po->n_textures;i++)	
		PIGGY_PAGE_IN( texture_list_index[i] );
	// Hmmm... cache got flushed in the middle of paging all these in,
	// so we need to reread them all in.
	if (piggy_page_flushed)	{
		piggy_page_flushed = 0;
		for (i=0;i<po->n_textures;i++)	
			PIGGY_PAGE_IN( texture_list_index[i] );
	}
	// Make sure that they can all fit in memory.
	Assert( piggy_page_flushed == 0 );
#endif

	g3_start_instance_matrix(pos,orient);

	g3_set_interp_points(robot_points);

#ifdef _3DFX
   _3dfx_rendering_poly_obj = 1;
#endif
	PA_DFX(save_light = Lighting_on);
	PA_DFX(Lighting_on = 0);

	if (flags == 0)		//draw entire object

		g3_draw_polygon_model(po->model_data,texture_list,anim_angles,light,glow_values);

	else {
		int i;
	
		for (i=0;flags;flags>>=1,i++)
			if (flags & 1) {
				vms_vector ofs;

				Assert(i < po->n_models);

				//if submodel, rotate around its center point, not pivot point
	
				vm_vec_avg(&ofs,&po->submodel_mins[i],&po->submodel_maxs[i]);
				vm_vec_negate(&ofs);
				g3_start_instance_matrix(&ofs,NULL);
	
				g3_draw_polygon_model(&po->model_data[po->submodel_ptrs[i]],texture_list,anim_angles,light,glow_values);
	
				g3_done_instance();
			}	
	}

	g3_done_instance();

#ifdef _3DFX
   _3dfx_rendering_poly_obj = 0;
#endif

	PA_DFX (Lighting_on = save_light);


}
Beispiel #12
0
void DrawPolygonModel (
    object			*objP,
    vms_vector		*pos,
    vms_matrix		*orient,
    vms_angvec		*anim_angles,
    int				model_num,
    int				flags,
    fix				light,
    fix				*glow_values,
    bitmap_index	altTextures [],
    tRgbColorf		*color)
{
    polymodel	*po;
    int			i, j, nTextures;
    PA_DFX (int save_light);

    if (model_num >= gameData.models.nPolyModels)
        return;
    Assert (model_num < gameData.models.nPolyModels);
    po = gameData.models.polyModels + model_num;
    if (objP && ((objP->type == OBJ_ROBOT) || (objP->type == OBJ_PLAYER)) && (gameStates.render.nShadowPass == 2)) {
        G3SetModelPoints (gameData.models.polyModelPoints);
        G3DrawPolyModelShadow (objP, po->model_data, anim_angles);
        return;
    }
    //check if should use simple model (depending on detail level chosen)
    if (po->simpler_model)					//must have a simpler model
        if (!flags) {							//can't switch if this is debris
            int	cnt = 1;
            fix depth = G3CalcPointDepth (pos);		//gets 3d depth
            while (po->simpler_model && (depth > cnt++ * gameData.models.nSimpleModelThresholdScale * po->rad))
                po = gameData.models.polyModels + po->simpler_model - 1;
        }
    nTextures = po->n_textures;
    if (altTextures) {
        for (i = 0; i < nTextures; i++)	{
            gameData.models.textureIndex [i] = altTextures [i];
            gameData.models.textures [i] = gameData.pig.tex.bitmaps [gameStates.app.bD1Model] + altTextures [i].index;
#ifdef _3DFX
            gameData.models.textures [i]->bm_handle = gameData.models.textureIndex [i].index;
#endif
        }
    }
    else {
        for (i = 0, j = po->first_texture; i < nTextures; i++, j++) {
            gameData.models.textureIndex [i] = gameData.pig.tex.objBmIndex [gameData.pig.tex.pObjBmIndex [j]];
            gameData.models.textures [i] = gameData.pig.tex.bitmaps [gameStates.app.bD1Model] + gameData.models.textureIndex [i].index;
#ifdef _3DFX
            gameData.models.textures [i]->bm_handle = gameData.models.textureIndex [i].index;
#endif
        }
    }

#ifdef PIGGY_USE_PAGING
    // Make sure the textures for this object are paged in...
    gameData.pig.tex.bPageFlushed = 0;
    for (i = 0; i < nTextures; i++)
        PIGGY_PAGE_IN (gameData.models.textureIndex [i], gameStates.app.bD1Model);
    // Hmmm... cache got flushed in the middle of paging all these in,
    // so we need to reread them all in.
    if (gameData.pig.tex.bPageFlushed)	{
        gameData.pig.tex.bPageFlushed = 0;
        for (i = 0; i < nTextures; i++)
            PIGGY_PAGE_IN (gameData.models.textureIndex [i], gameStates.app.bD1Model);
    }
    // Make sure that they can all fit in memory.
    Assert (gameData.pig.tex.bPageFlushed == 0);
#endif
    G3StartInstanceMatrix (pos, orient);
    G3SetModelPoints (gameData.models.polyModelPoints);
#ifdef _3DFX
    _3dfx_rendering_poly_obj = 1;
#endif
    PA_DFX (save_light = gameStates.render.nLighting);
    PA_DFX (gameStates.render.nLighting = 0);

    if (flags == 0)		//draw entire object
        G3DrawPolyModel (objP, po->model_data, gameData.models.textures, anim_angles, light, glow_values, color, NULL);
    else {
        int i;

        for (i = 0; flags; flags >>= 1, i++)
            if (flags & 1) {
                vms_vector ofs;

                Assert (i < po->n_models);
                //if submodel, rotate around its center point, not pivot point
                VmVecAvg (&ofs, &po->submodel_mins [i], &po->submodel_maxs [i]);
                VmVecNegate (&ofs);
                G3StartInstanceMatrix (&ofs, NULL);
                G3DrawPolyModel (objP, &po->model_data [po->submodel_ptrs [i]], gameData.models.textures, anim_angles,
                                 light, glow_values, color, NULL);
                G3DoneInstance ();
            }
    }
    G3DoneInstance ();
#ifdef _3DFX
    _3dfx_rendering_poly_obj = 0;
#endif
    PA_DFX (gameStates.render.nLighting = save_light);
}
Beispiel #13
0
void DrawPolygonModel (
	tObject			*objP, 
	vmsVector		*pos, 
	vmsMatrix		*orient, 
	vmsAngVec		*animAngles, 
	int				nModel, 
	int				flags, 
	fix				light, 
	fix				*glowValues, 
	tBitmapIndex	altTextures [], 
	tRgbColorf		*color)
{
	tPolyModel	*po;
	int			i, j, nTextures;
	PA_DFX (int bSaveLight);

if (nModel >= gameData.models.nPolyModels)
	return;
Assert (nModel < gameData.models.nPolyModels);
po = gameData.models.polyModels + nModel;
if (objP && ((objP->nType == OBJ_ROBOT) || (objP->nType == OBJ_PLAYER)) && (gameStates.render.nShadowPass == 2)) {
	G3SetModelPoints (gameData.models.polyModelPoints);
	G3DrawPolyModelShadow (objP, po->model_data, animAngles);
	return;
	}
//check if should use simple model (depending on detail level chosen)
if (po->simpler_model)					//must have a simpler model
	if (!flags) {							//can't switch if this is debris
		int	cnt = 1;
		fix depth = G3CalcPointDepth (pos);		//gets 3d depth
		while (po->simpler_model && (depth > cnt++ * gameData.models.nSimpleModelThresholdScale * po->rad))
			po = gameData.models.polyModels + po->simpler_model - 1;
		}
nTextures = po->n_textures;
if (altTextures) {
	for (i = 0; i < nTextures; i++)	{
		gameData.models.textureIndex [i] = altTextures [i];
		gameData.models.textures [i] = gameData.pig.tex.bitmaps [gameStates.app.bD1Model] + altTextures [i].index;
#ifdef _3DFX
      gameData.models.textures [i]->bm_handle = gameData.models.textureIndex [i].index;
#endif
		}
	}
else {
	for (i = 0, j = po->first_texture; i < nTextures; i++, j++) {
		gameData.models.textureIndex [i] = gameData.pig.tex.objBmIndex [gameData.pig.tex.pObjBmIndex [j]];
		gameData.models.textures [i] = gameData.pig.tex.bitmaps [gameStates.app.bD1Model] + gameData.models.textureIndex [i].index;
#ifdef _3DFX
      gameData.models.textures [i]->bm_handle = gameData.models.textureIndex [i].index;
#endif
	}
}

#ifdef PIGGY_USE_PAGING
// Make sure the textures for this tObject are paged in...
gameData.pig.tex.bPageFlushed = 0;
for (i = 0; i < nTextures; i++)	
	PIGGY_PAGE_IN (gameData.models.textureIndex [i], gameStates.app.bD1Model);
// Hmmm... cache got flushed in the middle of paging all these in, 
// so we need to reread them all in.
if (gameData.pig.tex.bPageFlushed)	{
	gameData.pig.tex.bPageFlushed = 0;
	for (i = 0; i < nTextures; i++)	
		PIGGY_PAGE_IN (gameData.models.textureIndex [i], gameStates.app.bD1Model);
}
// Make sure that they can all fit in memory.
Assert (gameData.pig.tex.bPageFlushed == 0);
#endif
G3StartInstanceMatrix (pos, orient);
G3SetModelPoints (gameData.models.polyModelPoints);
#ifdef _3DFX
_3dfx_rendering_poly_obj = 1;
#endif
PA_DFX (bSaveLight = gameStates.render.nLighting);
PA_DFX (gameStates.render.nLighting = 0);

if (flags == 0)		//draw entire tObject
	G3DrawPolyModel (objP, po->model_data, gameData.models.textures, animAngles, light, glowValues, color, NULL);
else {
	int i;

	for (i = 0; flags; flags >>= 1, i++)
		if (flags & 1) {
			vmsVector ofs;

			Assert (i < po->n_models);
			//if submodel, rotate around its center point, not pivot point
			VmVecAvg (&ofs, &po->submodel_mins [i], &po->submodel_maxs [i]);
			VmVecNegate (&ofs);
			G3StartInstanceMatrix (&ofs, NULL);
			G3DrawPolyModel (objP, &po->model_data [po->submodel_ptrs [i]], gameData.models.textures, animAngles, 
									light, glowValues, color, NULL);
			G3DoneInstance ();
			}	
	}
G3DoneInstance ();
#if 0
{
	g3sPoint p0, p1;

G3TransformPoint (&p0.p3_vec, &objP->pos);
VmVecSub (&p1.p3_vec, &objP->pos, &objP->mType.physInfo.velocity);
G3TransformPoint (&p1.p3_vec, &p1.p3_vec);
glLineWidth (20);
glDisable (GL_TEXTURE_2D);
glBegin (GL_LINES);
glColor4d (1.0, 0.5, 0.0, 0.3);
glVertex3x (p0.p3_vec.x, p0.p3_vec.y, -p0.p3_vec.z);
glColor4d (1.0, 0.5, 0.0, 0.1);
glVertex3x (p1.p3_vec.x, p1.p3_vec.y, -p1.p3_vec.z);
glEnd ();
glLineWidth (1);
}
#endif
#ifdef _3DFX
_3dfx_rendering_poly_obj = 0;
#endif
PA_DFX (gameStates.render.nLighting = bSaveLight);
}