Exemplo n.º 1
0
void TimelineDC::DrawFlag(const std::wstring& tooltip, int x, int y, COLORREF color, bool solid)
{
	CPen pen(CreatePen(PS_SOLID, 1, color));
	SelectPen(pen);
	if (solid)
		DrawSolidFlag(tooltip, x, y);
	else
		DrawFlag(tooltip, x, y);
}
Exemplo n.º 2
0
int main()
    {
    txCreateWindow (800, 600);

    DrawFrame();
    DrawEarth();
    DrawHello();
    DrawMan();
    DrawFlag();

    txTextCursor (false);
    return 0;
    }
Exemplo n.º 3
0
static void DecodeContents(int i)
{
	static const flagInfo_t contentsNames[] = {
#define T(name)		{CONTENTS_##name, #name}
		T(SOLID),	T(WINDOW),		T(AUX),		T(LAVA),	T(SLIME),		T(WATER),
		T(MIST),	T(ALPHA),		T(AREAPORTAL),	T(PLAYERCLIP),	T(MONSTERCLIP),
		T(CURRENT_0),	T(CURRENT_90),	T(CURRENT_180),	T(CURRENT_270),
		T(CURRENT_UP),	T(CURRENT_DOWN),T(ORIGIN),		T(MONSTER),
		T(DEADMONSTER),	T(DETAIL),		T(TRANSLUCENT),	T(LADDER)
#undef T
	};

//	RE_DrawTextLeft("Contents:", RGB(0.4, 0.4, 0.6));
//	RE_DrawTextLeft("---------", RGB(0.4, 0.4, 0.6));
	if (!i)
		RE_DrawTextLeft("CONTENTS_EMPTY", RGB(0.3, 0.6, 0.4));
	else
		DrawFlag(i, ARRAY_ARG(contentsNames), "CONTENTS_");
}
Exemplo n.º 4
0
void LevelEditor () {
	int i=0;
	int j=0;
	if (Panel==0) {
		if ((Key=='d' || Arrow=='M') && Tile_X<399) Tile_X++;
		if ((Key=='a' || Arrow=='K') && Tile_X>0) Tile_X--;
		if ((Key=='s' || Arrow=='P') && Tile_Y<8) Tile_Y++;
		if ((Key=='w' || Arrow=='H') && Tile_Y>0) Tile_Y--;
		if ((Key==' ' || Arrow==28)) {
			if (Tile_Type==5) {
				for (i=0; i<LEVEL_MAXLEN; i++) if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)==5) *(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+i)=0;
				*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X)=5;
			} else {
				*(Levels[CURRENT_LEVEL]+Tile_Y*LEVEL_MAXLEN+Tile_X)=Tile_Type;
			}
		}
	}
	if (Panel==1) {
		if ((Key=='s' || Arrow=='P') && Tile_Type<5) Tile_Type++;
		if ((Key=='w' || Arrow=='H') && Tile_Type>0) Tile_Type--;
	}
	if (Panel==2) {
		if ((Key=='s' || Arrow=='P') && Q_SELECTED<5) Q_SELECTED++;
		if ((Key=='w' || Arrow=='H') && Q_SELECTED>0) Q_SELECTED--;
		if ((Key==' ' || Arrow==28) && Q_SELECTED==0) {
			GAME_TYPE=1;
			if (GLOBAL_CHECKPOINT>0) {
				int isCheck=0;
				for (i=0;i<9; i++) {
					int CurBlock=*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+GLOBAL_CHECKPOINT);
					if (CurBlock==4) {
						SPAWN_Y=(i+1)*43+41+70-DeltaH[HeroSides];
						isCheck=1;
						break;
					}
				}
				if (isCheck==0) {
					DrawText (100,300,"error (checkpoint not found)",GLOBAL_FRONTCOLOR);
					Update();
					_ksys_delay(200);
					GAME_TYPE=3;
					Panel=1;
					return;
				}
				ResetLevel(CURRENT_LEVEL);
				isRestart=0;
				HeroIsDead=0;
				HeroFly=0;
				HeroY=SPAWN_Y;
				if (HeroSides>7) HeroY-=22;
				if (HeroSides%2==0) {
				       HeroAngle=360/(HeroSides*2);
				} else {
				       HeroAngle=0;
				}
			}
		}
		if (Q_SELECTED==1) {
			if ((Key=='d' || Arrow=='M') && GLOBAL_CHECKPOINT<399) GLOBAL_CHECKPOINT++;
			if ((Key=='a' || Arrow=='K') && GLOBAL_CHECKPOINT>0) GLOBAL_CHECKPOINT--;
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==2) {
			for (i=0; i<9; i++) {
				for (j=0; j<LEVEL_MAXLEN; j++) {
					*(Levels[CURRENT_LEVEL]+i*LEVEL_MAXLEN+j)=0;
				}
			}
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==3) SaveArray();
		if (Q_SELECTED==4) {
			if ((Key=='a' || Arrow=='K') && LevelProps[CURRENT_LEVEL][2]>3) LevelProps[CURRENT_LEVEL][2]--;
			if ((Key=='d' || Arrow=='M') && LevelProps[CURRENT_LEVEL][2]<10) LevelProps[CURRENT_LEVEL][2]++;
			HeroSides=LevelProps[CURRENT_LEVEL][2];
		}
		if ((Key==' ' || Arrow==28) && Q_SELECTED==5) GAME_TYPE=0;
	}
	if (Key=='e') {
		if (Panel==0) {
			Panel=1;
		} else {
			Panel=0;
		}
	}
	if (Key=='q') {
		if (Panel==0) {
			Panel=2;
		} else {
			Panel=0;
		}
	}
	//Draw grid
	for (i=0; i<=10; i++) {
		DrawLine (43*i,0,43*i,43*9,GLOBAL_FRONTCOLOR);
	}
	for (i=0; i<=9; i++) {
		DrawLine (0,43*i,430,43*i,GLOBAL_FRONTCOLOR);
	}
	//Draw panel
	DrawText (450,10,"e_tools",GLOBAL_FRONTCOLOR);
	IntToStr (Tile_X,NUMBER);
	DrawText (450,30,"(",GLOBAL_FRONTCOLOR);
	DrawText (470,30,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (530,30,"/",GLOBAL_FRONTCOLOR);
	IntToStr (Tile_Y,NUMBER);
	DrawText (550,30,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (570,30,")",GLOBAL_FRONTCOLOR);

	DrawLine (480,70,530,70,GLOBAL_FRONTCOLOR);
	DrawLine (480,70,480,70+300,GLOBAL_FRONTCOLOR);
	DrawLine (530,70,530,70+300,GLOBAL_FRONTCOLOR);
	for (i=1;i<=6; i++) DrawLine (480,70+50*i,530,70+50*i,GLOBAL_FRONTCOLOR);
	//Empty block
	DrawLine (480+4,70+4,480+42,70+42,GLOBAL_FRONTCOLOR);
	DrawLine (480+4,70+42,480+42,70+4,GLOBAL_FRONTCOLOR);
	DrawBlock (480+4,70+4+50,GLOBAL_FRONTCOLOR);
	DrawPit (480+7,70+4+100,GLOBAL_FRONTCOLOR);
	DrawBatut (480+4,70+4+150,GLOBAL_FRONTCOLOR);
	DrawFlag (480+8,70+4+200,GLOBAL_FRONTCOLOR);
	DrawText (480+14,70+14+250,"f",GLOBAL_FRONTCOLOR);
	DrawText (450,400,TILENAME [Tile_Type],GLOBAL_FRONTCOLOR);

	//Draw properties
	DrawText (10,410,"q_properties",GLOBAL_FRONTCOLOR);
	DrawText (10,430+20,"test level",GLOBAL_FRONTCOLOR);
	DrawText (10,470,"start column <     >",GLOBAL_FRONTCOLOR);
	IntToStr (GLOBAL_CHECKPOINT,NUMBER);
	DrawText (270,470,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (10,490,"reset level",GLOBAL_FRONTCOLOR);
	DrawText (10,510,"save as 2d array (for developers)",GLOBAL_FRONTCOLOR);
	DrawText (10,530,"hero sides <   >",GLOBAL_FRONTCOLOR);
	IntToStr (LevelProps[CURRENT_LEVEL][2],NUMBER);
	DrawText (230,530,NUMBER,GLOBAL_FRONTCOLOR);
	DrawText (10,550,"back to menu",GLOBAL_FRONTCOLOR);

	if (Panel==0) {
		DrawLine ((Tile_X%10)*43,0,(Tile_X%10)*43,400,HeroColor);
		DrawLine ((Tile_X%10)*43+43,0,(Tile_X%10)*43+43,400,HeroColor);
		DrawLine (0,(Tile_Y%10)*43,440,(Tile_Y%10)*43,HeroColor);
		DrawLine (0,(Tile_Y%10)*43+43,440,(Tile_Y%10)*43+43,HeroColor);
	}
	if (Panel==1) {
		DrawText (450,10,"e_tools",HeroColor);
		DrawLine (480,70+Tile_Type*50,530,70+Tile_Type*50,HeroColor);
		DrawLine (480,70+Tile_Type*50,480,70+50+Tile_Type*50,HeroColor);
		DrawLine (480,70+Tile_Type*50+50,530,70+50+Tile_Type*50,HeroColor);
		DrawLine (530,70+Tile_Type*50,530,70+Tile_Type*50+50,HeroColor);
		DrawText (450,400,TILENAME [Tile_Type],HeroColor);
	}
	if (Panel==2) {
	       DrawText (10,410,"q_properties",HeroColor);
	       if (Q_SELECTED==0) DrawText (10,450,"test level",HeroColor);
	       if (Q_SELECTED==1) DrawText (10,470,"start column <     >",HeroColor);
	       if (Q_SELECTED==2) DrawText (10,490,"reset level",HeroColor);
	       if (Q_SELECTED==3) DrawText (10,510,"save as 2d array (for developers)",HeroColor);
	       if (Q_SELECTED==4) DrawText (10,530,"hero sides <   >",HeroColor);
	       if (Q_SELECTED==5) DrawText (10,550,"back to menu",HeroColor);
	}

	for (i=0; i<10; i++) {
		for (j=0; j<9; j++) {
			int CurBlock=*(Levels[CURRENT_LEVEL]+j*LEVEL_MAXLEN+Tile_X-Tile_X%10+i);
			if (CurBlock==1) DrawBlock (43*i,43*j,GLOBAL_BLOCKCOLOR);
			if (CurBlock==2) DrawPit (43*i,43*j,GLOBAL_PITCOLOR);
			if (CurBlock==3) DrawBatut (43*i,43*j,GLOBAL_BATUTCOLOR);
			if (CurBlock==4) DrawFlag (43*i,43*j,GLOBAL_FLAGCOLOR);

		}
		if (*(Levels[CURRENT_LEVEL]+0*LEVEL_MAXLEN+Tile_X-Tile_X%10+i)==5) {
			for (j=0; j<9;j++) {
				DrawText (43*i+10,43*j+10,"f",GLOBAL_FRONTCOLOR);
			}
		}
	}
	if (Key==27) {
		GAME_TYPE=0;
	}
}
Exemplo n.º 5
0
static void DrawSurfInfo()
{
	static const flagInfo_t surfNames[] = {
#define T(name)		{SURF_##name, #name}
		T(LIGHT), T(SLICK), T(SKY), T(WARP),
		T(TRANS33), T(TRANS66), T(FLOWING), T(NODRAW),
		// Kingpin flags
		T(ALPHA), T(DIFFUSE), T(SPECULAR),
		// new flags (temp ??)
		T(AUTOFLARE)
#undef T
	};

	static const char *materialNames[MATERIAL_COUNT] = {
		"silent",
		"concrete",
		"fabric",
		"gravel",
		"metal",
		"metal_l",
		"snow",
		"tin",
		"tile",
		"wood",
		"water",
		"glass",
		"dirt"
	};

	CVec3 start, end;
	start = cl.refdef.vieworg;
	Euler2Vecs(cl.refdef.viewangles, &end, NULL, NULL);
	end.Scale(500);
	end.Add(start);

	unsigned cont = r_surfinfo->integer & 4 ? MASK_ALL : MASK_SHOT|MASK_WATER;
	trace_t	trace;
#if TRACE_DEBUG
	cm_showTrace = true;
#endif
//static CBox nullBox = {{-2,-2,-2},{2,2,2}};
//static CBox nullBox = {{-10,-10,-10},{10,10,10}};
//static CBox nullBox = {{-20,-20,-20},{20,20,20}};
	CM_BoxTrace(trace, start, end, nullBox, 0, cont);
	CM_ClipTraceToModels(trace, start, end, nullBox, cont);
#if TRACE_DEBUG
	cm_showTrace = false;
#endif
	if (!(r_surfinfo->integer & 2))
		CL_EntityTrace(trace, start, end, nullBox, cont);
	V_AddLight(trace.endpos, 5, 0.3, 0.6, 0.3);	//?? keep or remove? intens > trace bounds!

	if (trace.fraction < 1.0)
	{
		if (trace.brushNum >= 0)
		{
			// brush
			RE_DrawTextLeft(va("BrushNum: %d", trace.brushNum), RGB(0.2,0.4,0.1));
			if (r_surfinfo->integer & 8)
			{
				// visualize brush
				if (!debugMem) debugMem = new CMemoryChain;
				CBrush *brush = CM_BuildBrush(trace.brushNum, debugMem);
				if (brush)
					RE_DrawBrush(brush, "brush", trace.brushNum);
				else
					RE_DrawTextLeft(va("brush %d: error", trace.brushNum), RGB(1,0,0));
			}
		}
		RE_DrawTextLeft("Surface info:\n-------------", RGB(0.4,0.4,0.6));
		RE_DrawTextLeft(va("Point: %g  %g  %g", VECTOR_ARG(trace.endpos)), RGB(0.2,0.4,0.1));
		csurface_t *surf = trace.surface;
		RE_DrawTextLeft(va("Normal: %g  %g  %g", VECTOR_ARG(trace.plane.normal)), RGB(0.2,0.4,0.1));
		if (surf->fullName[0])		// non-null surface
		{
			RE_DrawTextLeft(va("Texture: %s", surf->fullName), RGB(0.2,0.4,0.1));
			if (surf->value)
				RE_DrawTextLeft(va("Value: %d", surf->value), RGB(0.2,0.4,0.1));
			DrawFlag(surf->flags, ARRAY_ARG(surfNames), "SURF_");
			// material
			const char *s = (surf->material > 0 && surf->material < MATERIAL_COUNT) ?
				materialNames[surf->material] : "?? bad ??";
			RE_DrawTextLeft(va("Material: %s", s), RGB(0.3,0.6,0.4));
		}
		DecodeContents(trace.contents);
		if (trace.ent)
		{
			clEntityState_t *ent = (clEntityState_t*)trace.ent;
			RE_DrawTextLeft("\nEntity:\n-------", RGB(0.4,0.4,0.6));
			RE_DrawTextLeft(va("Origin: %g %g %g", VECTOR_ARG(ent->origin)), RGB(0.2,0.4,0.1));
			RE_DrawTextLeft(va("fx: %X  rfx: %X", ent->effects, ent->renderfx), RGB(0.2,0.4,0.1));
			if (ent->modelindex)	RE_DrawTextLeft(va("model: %s", ModelName(ent->modelindex)), RGB(0.2,0.4,0.1));
			if (ent->modelindex2)	RE_DrawTextLeft(va("model2: %s", ModelName(ent->modelindex2)), RGB(0.2,0.4,0.1));
			if (ent->modelindex3)	RE_DrawTextLeft(va("model3: %s", ModelName(ent->modelindex3)), RGB(0.2,0.4,0.1));
			if (ent->modelindex4)	RE_DrawTextLeft(va("model4: %s", ModelName(ent->modelindex4)), RGB(0.2,0.4,0.1));

			CL_AddEntityBox(ent, RGB(1,0.1,0.1));
		}
		RE_DrawTextLeft("");	// empty line
	}
}