Exemple #1
0
void CheatDrawText() {
	
	if(sp_max_start == PlatformInstant_ZERO)
		return;
	
	PlatformDuration elapsed = g_platformTime.frameStart() - sp_max_start;

	if(sp_max_start != PlatformInstant_ZERO && elapsed < PlatformDurationMs(20000)) {
		float modi = float(toMs(PlatformDurationMs(20000) - elapsed)) * ( 1.0f / 2000 ) * ( 1.0f / 10 );
		float sizX = 16;
		
		Vec2f p = Vec2f(g_size.center());
		p.x -= sp_max_ch.length() * ( 1.0f / 2 ) * sizX;
		
		for(size_t i = 0; i < sp_max_ch.length(); i++) {
			Vec2f d = p + Vec2f(sizX * i, sp_max_y[i]);
			
			sp_max_y[i] = std::sin(d.x + arxtime.now_f() * ( 1.0f / 100 )) * 30.f * modi;
			std::string tex(1, sp_max_ch[i]);

			UNICODE_ARXDrawTextCenter(hFontInBook, d + Vec2f(-1,-1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, d + Vec2f( 1, 1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, d, tex, sp_max_col[i]);
		}
	}
}
Exemple #2
0
void CheatDrawText() {
	
	if(sp_max_start == 0) {
		return;
	}
	
	PlatformDuration elapsed = g_platformTime.frameStart() - sp_max_start;
	
	if(elapsed < PlatformDurationMs(20000)) {
		
		float modi = (PlatformDurationMs(20000) - elapsed) / PlatformDurationMs(2000) * 0.1f;
		float sizX = 16;
		
		Vec2f p = Vec2f(g_size.center());
		p.x -= sp_max_ch.length() * 0.5f * sizX;
		
		for(size_t i = 0; i < sp_max_ch.length(); i++) {
			Vec2f d = p + Vec2f(sizX * i, sp_max_y[i]);
			
			sp_max_y[i] = std::sin(d.x + elapsed / PlatformDurationMs(100)) * 30.f * modi;
			std::string tex(1, sp_max_ch[i]);
			
			UNICODE_ARXDrawTextCenter(hFontInGame, d + Vec2f(-1, -1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInGame, d + Vec2f(1, 1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInGame, d, tex, sp_max_col[i]);
		}
		
	}
	
}
static void drawDebugEntities() {
	
	for(size_t i = 1; i < entities.size(); i++) {
		const EntityHandle handle = EntityHandle(i);
		Entity * entity = entities[handle];
		
		if(!entity) {
			continue;
		}
		
		Color color = Color::white;
		bool visible = true;
		switch(entity->show) {
			case SHOW_FLAG_DESTROYED:    continue; // Don't even display the name
			case SHOW_FLAG_IN_INVENTORY: continue;
			case SHOW_FLAG_ON_PLAYER:    continue;
			case SHOW_FLAG_LINKED:       continue;
			case SHOW_FLAG_NOT_DRAWN:    color = Color::magenta; visible = false; break;
			case SHOW_FLAG_HIDDEN:       color = Color::yellow;  visible = false; break;
			case SHOW_FLAG_MEGAHIDE:     color = Color::green;   visible = false; break;
			case SHOW_FLAG_KILLED:       color = Color::red;     visible = false; break;
			case SHOW_FLAG_IN_SCENE:     color = Color::white;   visible = true;  break;
			case SHOW_FLAG_TELEPORTING:  color = Color::blue;    visible = true;  break;
		}
		if((entity->ioflags & IO_CAMERA) || (entity->ioflags & IO_MARKER)) {
			color = Color::gray(0.7f), visible = false;
		}
		if(DRAGINTER == entity) {
			color = Color::white, visible = true;
		}
		
		if(visible) {
			drawDebugBoundingBox(entity->bbox2D, Color::blue);
		}
		
		if(closerThan(entity->pos, player.pos, DebugTextMaxDistance)) {
			
			if(visible && entity->bbox2D.valid()) {
				int x = (entity->bbox2D.min.x + entity->bbox2D.max.x) / 2;
				int y = entity->bbox2D.min.y - hFontDebug->getLineHeight() - 2;
				UNICODE_ARXDrawTextCenter(hFontDebug, Vec2f(x, y), entity->idString(), color);
			} else {
				drawTextAt(hFontDebug, entity->pos, entity->idString(), color);
			}
			
			if(entity->obj) {
				for(size_t j = 0; j < entity->obj->linked.size(); j++) {
					Vec3f pos = actionPointPosition(entity->obj, entity->obj->linked[j].lidx);
					Entity * other = entity->obj->linked[j].io;
					drawTextAt(hFontDebug, pos, other->idString(), Color::cyan);
				}
			}
			
		}
		
	}
	
}
Exemple #4
0
void Manage_sp_max() {

	float v = float(arxtime) - sp_max_start;

	if(sp_max_start != 0 && v < 20000) {
		float modi = (20000 - v) * ( 1.0f / 2000 ) * ( 1.0f / 10 );
		float sizX = 16;
		float px = (float)g_size.center().x - (float)sp_max_ch.length() * ( 1.0f / 2 ) * sizX;
		float py = (float)g_size.center().y;

		for(size_t i = 0; i < sp_max_ch.length(); i++) {
			float dx = px + sizX * (float)i;
			float dy = py + sp_max_y[i];
			sp_max_y[i] = std::sin(dx + (float)float(arxtime) * ( 1.0f / 100 )) * 30.f * modi;
			std::string tex(1, sp_max_ch[i]);

			UNICODE_ARXDrawTextCenter(hFontInBook, Vec2f(dx - 1, dy - 1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, Vec2f(dx + 1, dy + 1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, Vec2f(dx, dy), tex, sp_max_col[i]);
		}
	}
}
Exemple #5
0
void Manage_sp_max() {

	float v = float(arxtime) - sp_max_start;

	if(sp_max_start != 0 && v < 20000) {
		float modi = (20000 - v) * ( 1.0f / 2000 ) * ( 1.0f / 10 );
		float sizX = 16;
		
		Vec2f p = Vec2f(g_size.center());
		p.x -= (float)sp_max_ch.length() * ( 1.0f / 2 ) * sizX;
		
		for(size_t i = 0; i < sp_max_ch.length(); i++) {
			Vec2f d = p + Vec2f(sizX * (float)i, sp_max_y[i]);
			
			sp_max_y[i] = std::sin(d.x + (float)float(arxtime) * ( 1.0f / 100 )) * 30.f * modi;
			std::string tex(1, sp_max_ch[i]);

			UNICODE_ARXDrawTextCenter(hFontInBook, d + Vec2f(-1,-1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, d + Vec2f( 1, 1), tex, Color::none);
			UNICODE_ARXDrawTextCenter(hFontInBook, d, tex, sp_max_col[i]);
		}
	}
}
Exemple #6
0
static void ARX_INTERFACE_RenderCursorInternal(bool flag) {
	
	if(SelectSpellTargetCursorRender()) {
		return;
	}
	
	if(!(flag || (!BLOCK_PLAYER_CONTROLS && PLAYER_INTERFACE_HIDE_COUNT))) {
		return;
	}
		
	if(!SPECIAL_DRAGINTER_RENDER)
		GRenderer->SetCulling(CullNone);
	
	if(COMBINE || COMBINEGOLD) {
		if(SpecialCursor == CURSOR_INTERACTION_ON)
			SpecialCursor = CURSOR_COMBINEON;
		else
			SpecialCursor = CURSOR_COMBINEOFF;
	}
	
	if(!SPECIAL_DRAGINTER_RENDER) {
		if(FlyingOverIO || DRAGINTER) {
			fHighLightAng += g_framedelay * 0.5f;
			
			if(fHighLightAng > 90.f)
				fHighLightAng = 90.f;
			
			float fHLight = 100.f * glm::sin(glm::radians(fHighLightAng));
			
			iHighLight = checked_range_cast<int>(fHLight);
		} else {
			fHighLightAng = 0.f;
			iHighLight = 0;
		}
	}
	
	if(   SpecialCursor
	   || !PLAYER_MOUSELOOK_ON
	   || DRAGINTER
	   ||  (FlyingOverIO
		 && PLAYER_MOUSELOOK_ON
		 && !g_cursorOverBook
		 && (eMouseState != MOUSE_IN_NOTE)
		 && (FlyingOverIO->ioflags & IO_ITEM)
		 && (FlyingOverIO->gameFlags & GFLAG_INTERACTIVITY)
		 && (config.input.autoReadyWeapon == false))
	   || (MAGICMODE && PLAYER_MOUSELOOK_ON)
	) {
		CANNOT_PUT_IT_HERE = EntityMoveCursor_Ok;
		float ag=player.angle.getPitch();
		
		if(ag > 180)
			ag = ag - 360;
		
		float drop_miny = float(g_size.center().y) - float(g_size.center().y) * ag * (1.0f/70);
		
		if(   DANAEMouse.y > drop_miny
		   && DRAGINTER
		   && !InInventoryPos(DANAEMouse)
		   && !g_cursorOverBook
		) {
			if(!Manage3DCursor(DRAGINTER, true))
				CANNOT_PUT_IT_HERE = EntityMoveCursor_Throw;
			
			if(SPECIAL_DRAGINTER_RENDER) {
				CANNOT_PUT_IT_HERE = EntityMoveCursor_Ok;
				return;
			}
		} else {
			CANNOT_PUT_IT_HERE = EntityMoveCursor_Throw;
		}
		
		if(SPECIAL_DRAGINTER_RENDER)
			return;
		
		Vec2f mousePos = Vec2f(DANAEMouse);
		
		if(SpecialCursor && !DRAGINTER) {
			if((COMBINE && COMBINE->m_icon) || COMBINEGOLD) {
				if(TRUE_PLAYER_MOUSELOOK_ON && (config.input.autoReadyWeapon)) {
					mousePos = MemoMouse;
				}
				
				TextureContainer * tc;
				
				if(COMBINEGOLD)
					tc = GoldCoinsTC[5];
				else
					tc = COMBINE->m_icon;
				
				Vec2f size(tc->m_size.x, tc->m_size.y);
				
				if(SpecialCursor == CURSOR_COMBINEON) {
					EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), .00001f, tc, Color::white);
					
					if(FlyingOverIO && (FlyingOverIO->ioflags & IO_BLACKSMITH)) {
						float v=ARX_DAMAGES_ComputeRepairPrice(COMBINE,FlyingOverIO);
						
						if(v > 0.f) {
							long t = long(v);
							Vec2f nuberOffset = Vec2f(-16, -10);
							ARX_INTERFACE_DrawNumber(mousePos + nuberOffset, t, 6, Color::cyan, 1.f);
						}
					}
				} else {
					EERIEDrawBitmap(Rectf(mousePos, size.x, size.y), 0.00001f, tc, Color(255, 170, 102, 255));
				}
			}
			
			TextureContainer * surf;
			
			switch(SpecialCursor) {
			case CURSOR_REDIST:
				surf = cursorRedist;
				break;
			case CURSOR_COMBINEOFF:
				surf = cursorTargetOff;
				mousePos.x -= 16.f;
				mousePos.y -= 16.f;
				break;
			case CURSOR_COMBINEON:
				surf = cursorTargetOn;
				arx_assert(surf);
				
				mousePos.x -= 16.f;
				mousePos.y -= 16.f;
				break;
			case CURSOR_FIREBALLAIM: {
				surf = cursorTargetOn;
				arx_assert(surf);
				
				mousePos = Vec2f(320.f, 280.f) - Vec2f(surf->m_size) * 0.5f;
				break;
			}
			case CURSOR_INTERACTION_ON:
				cursorAnimatedHand.update1();
				surf = cursorAnimatedHand.getCurrentTexture();
				break;
			default:
				cursorAnimatedHand.update2();
				surf = cursorAnimatedHand.getCurrentTexture();
				break;
			}
			
			arx_assert(surf);
			
			if(SpecialCursor == CURSOR_REDIST) {
				EERIEDrawBitmap(Rectf(mousePos, float(surf->m_size.x) * g_sizeRatio.x, float(surf->m_size.y) * g_sizeRatio.y),
								0.f, surf, Color::white);
				
				Vec2f textPos = Vec2f(DANAEMouse);
				textPos += Vec2f(17.5f, 12.5f) * g_sizeRatio;
				
				std::stringstream ss;
				ss << std::setw(3) << lCursorRedistValue;
				
				UNICODE_ARXDrawTextCenter(hFontInBook, textPos, ss.str(), Color::black);
			} else {
				
				EERIEDrawBitmap(Rectf(mousePos, float(surf->m_size.x), float(surf->m_size.y)), 0.f, surf, Color::white);
			}
			
			SpecialCursor = 0;
		} else {
			if(   !(player.m_currentMovement & PLAYER_CROUCH)
			   && !BLOCK_PLAYER_CONTROLS
			   && GInput->actionPressed(CONTROLS_CUST_MAGICMODE)
			   && ARXmenu.currentmode == AMCM_OFF
			) {
				if(!MAGICMODE) {
					if(player.Interface & INTER_MAP) {
						ARX_INTERFACE_BookClose(); // Forced Closing
					}
					MAGICMODE = true;
				}
				
				TextureContainer * surf = cursorMagic;
				
				Vec2f pos = Vec2f(DANAEMouse);
				
				if(TRUE_PLAYER_MOUSELOOK_ON) {
					pos = MemoMouse;
				}
				
				Vec2f size(surf->m_size.x, surf->m_size.y);
				
				pos += -size * 0.5f;
				
				EERIEDrawBitmap(Rectf(pos, size.x, size.y), 0.f, surf, Color::white);
			} else {
				if(MAGICMODE) {
					ARX_SOUND_Stop(SND_MAGIC_DRAW);
					MAGICMODE = false;
				}
				
				if(DRAGINTER && DRAGINTER->m_icon) {
					TextureContainer * tc = DRAGINTER->m_icon;
					TextureContainer * haloTc = NULL;
					
					if(NeedHalo(DRAGINTER))
						haloTc = DRAGINTER->m_icon->getHalo();//>_itemdata->halo_tc;
					
					Color color = (DRAGINTER->poisonous && DRAGINTER->poisonous_count != 0) ? Color::green : Color::white;
					
					Vec2f pos = mousePos;
					
					if(TRUE_PLAYER_MOUSELOOK_ON && config.input.autoReadyWeapon) {
						pos = MemoMouse;
					}
					
					Rectf rect(pos, float(tc->m_size.x), float(tc->m_size.y));
					
					if(!(DRAGINTER->ioflags & IO_MOVABLE)) {
						EERIEDrawBitmap(rect, .00001f, tc, color);
						
						if((DRAGINTER->ioflags & IO_ITEM) && DRAGINTER->_itemdata->count != 1) {
							Vec2f nuberOffset = Vec2f(2.f, 13.f);
							ARX_INTERFACE_DrawNumber(pos + nuberOffset, DRAGINTER->_itemdata->count, 3, Color::white, 1.f);
						}
					} else {
						if((InInventoryPos(DANAEMouse) || g_secondaryInventoryHud.containsPos(DANAEMouse)) || CANNOT_PUT_IT_HERE != EntityMoveCursor_Throw) {
							EERIEDrawBitmap(rect, .00001f, tc, color);
						}
					}
					
					//cross not over inventory icon
					if(   CANNOT_PUT_IT_HERE != EntityMoveCursor_Ok
					   && (eMouseState != MOUSE_IN_INVENTORY_ICON)
					   && !InInventoryPos(DANAEMouse)
					   && !g_secondaryInventoryHud.containsPos(DANAEMouse)
					   && !ARX_INTERFACE_MouseInBook()) {
						TextureContainer * tcc = cursorMovable;
						
						if(CANNOT_PUT_IT_HERE == EntityMoveCursor_Throw)
							tcc = cursorThrowObject;
						
						if(tcc && tcc != tc) // to avoid movable double red cross...
							EERIEDrawBitmap(Rectf(Vec2f(pos.x + 16, pos.y), float(tcc->m_size.x), float(tcc->m_size.y)), 0.00001f, tcc, Color::white);
					}
					
					if(haloTc) {
						ARX_INTERFACE_HALO_Draw(DRAGINTER, tc, haloTc, pos, Vec2f(1));
					}
				} else {
					cursorAnimatedHand.update2();
					TextureContainer * surf = cursorAnimatedHand.getCurrentTexture();
					
					if(surf) {
						EERIEDrawBitmap(Rectf(mousePos, float(surf->m_size.x), float(surf->m_size.y)), 0.f, surf, Color::white);
					}
				}
			}
		}
	} else { //mode system shock
		if(SPECIAL_DRAGINTER_RENDER)
			return;
		
		if(   TRUE_PLAYER_MOUSELOOK_ON
		   && config.interface.showCrosshair
		   && !(player.Interface & (INTER_COMBATMODE | INTER_NOTE | INTER_MAP))) {
			
			cursorAnimatedHand.reset();
			
			TextureContainer * surf = cursorCrossHair;
			arx_assert(surf);
			
			GRenderer->SetRenderState(Renderer::AlphaBlending, true);
			GRenderer->SetBlendFunc(BlendOne, BlendOne);
			
			Vec2f pos = Vec2f(g_size.center()) - Vec2f(surf->m_size) * .5f;
			
			EERIEDrawBitmap(Rectf(pos, float(surf->m_size.x), float(surf->m_size.y)), 0.f, surf, Color3f::gray(.5f).to<u8>());
			
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
		}
	}
}
Exemple #7
0
void DrawBookTextCenter(Font* font, const Vec2f & pos, const std::string& text, Color col)
{
	UNICODE_ARXDrawTextCenter(font, (BOOKDEC + pos) * g_sizeRatio, text, col);
}