Ejemplo n.º 1
0
void gtia_device::render(UINT8 *src, UINT8 *dst, UINT8 *prio, UINT8 *pmbits)
{
	if (m_h.grafp0)
		player_render(m_h.grafp0, m_w.sizep0 + 1, GTIA_P0, &pmbits[m_w.hposp0]);
	if (m_h.grafp1)
		player_render(m_h.grafp1, m_w.sizep1 + 1, GTIA_P1, &pmbits[m_w.hposp1]);
	if (m_h.grafp2)
		player_render(m_h.grafp2, m_w.sizep2 + 1, GTIA_P2, &pmbits[m_w.hposp2]);
	if (m_h.grafp3)
		player_render(m_h.grafp3, m_w.sizep3 + 1, GTIA_P3, &pmbits[m_w.hposp3]);

	if (m_h.grafm0)
		missile_render(m_h.grafm0, m_w.sizem + 1, GTIA_M0, &pmbits[m_w.hposm0]);
	if (m_h.grafm1)
		missile_render(m_h.grafm1, m_w.sizem + 1, GTIA_M1, &pmbits[m_w.hposm1]);
	if (m_h.grafm2)
		missile_render(m_h.grafm2, m_w.sizem + 1, GTIA_M2, &pmbits[m_w.hposm2]);
	if (m_h.grafm3)
		missile_render(m_h.grafm3, m_w.sizem + 1, GTIA_M3, &pmbits[m_w.hposm3]);

	for (int x = 0; x < GTIA_HWIDTH * 4; x++, src++, dst++)
	{
		UINT8 pm, pc, pf;
		if (!*src)
			continue;
		/* get the player/missile combination bits and reset the buffer */
		pm = *src;
		*src = 0;
		/* get the current playfield color */
		pc = *dst;
		pf = pf_collision[pc];
		if (pm & GTIA_P0) { m_r.p0pf |= pf; m_r.p0pl |= pm & (          GTIA_P1 | GTIA_P2 | GTIA_P3); }
		if (pm & GTIA_P1) { m_r.p1pf |= pf; m_r.p1pl |= pm & (GTIA_P0 |           GTIA_P2 | GTIA_P3); }
		if (pm & GTIA_P2) { m_r.p2pf |= pf; m_r.p2pl |= pm & (GTIA_P0 | GTIA_P1 |           GTIA_P3); }
		if (pm & GTIA_P3) { m_r.p3pf |= pf; m_r.p3pl |= pm & (GTIA_P0 | GTIA_P1 | GTIA_P2          ); }
		if (pm & GTIA_M0) { m_r.m0pf |= pf; m_r.m0pl |= pm & (GTIA_P0 | GTIA_P1 | GTIA_P2 | GTIA_P3); }
		if (pm & GTIA_M1) { m_r.m1pf |= pf; m_r.m1pl |= pm & (GTIA_P0 | GTIA_P1 | GTIA_P2 | GTIA_P3); }
		if (pm & GTIA_M2) { m_r.m2pf |= pf; m_r.m2pl |= pm & (GTIA_P0 | GTIA_P1 | GTIA_P2 | GTIA_P3); }
		if (pm & GTIA_M3) { m_r.m3pf |= pf; m_r.m3pl |= pm & (GTIA_P0 | GTIA_P1 | GTIA_P2 | GTIA_P3); }
		/* color with higher priority? change playfield */
		pc = prio[pf_prioindex[pc] | pm];
		if (pc) *dst = pc;
	}
	/* copy player/missile graphics in case of vdelay */
	m_w.grafp0[1] = m_w.grafp0[0];
	m_w.grafp1[1] = m_w.grafp1[0];
	m_w.grafp2[1] = m_w.grafp2[0];
	m_w.grafp3[1] = m_w.grafp3[0];
	m_w.grafm[1] = m_w.grafm[0];
}
Ejemplo n.º 2
0
/*
 * Render the current frame
 */
void render(void)
{
    int index;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // Move the camera to the correct position
    camera_render();

    // Render the player
    player_render();
    glCallList(OBJECT_LANDSCAPE);

    // Render the buildings in 3 quadrants of the map
    for( index = 0; index < MODEL_COUNT; index++ )
    {
        glPushMatrix();
        glTranslatef(g_pModels[index].position[0], 0, g_pModels[index].position[1]);
        glRotatef(g_pModels[index].rotation, 0, 1.0f, 0);
        glCallList(g_pModels[index].call_identifier);
        glPopMatrix();
        glPushMatrix();
        glTranslatef(-g_pModels[index].position[0], 0, g_pModels[index].position[1]);
        glRotatef(g_pModels[index].rotation - 90, 0, 1.0f, 0);
        glCallList(g_pModels[index].call_identifier);
        glPopMatrix();
        glPushMatrix();
        glTranslatef(g_pModels[index].position[0], 0, -g_pModels[index].position[1]);
        glRotatef(g_pModels[index].rotation + 90, 0, 1.0f, 0);
        glCallList(g_pModels[index].call_identifier);
        glPopMatrix();
    }

    // Render the jeep
    glTranslatef(g_pModelJeep.position[0], 0, g_pModelJeep.position[1]);
    glRotatef(g_pModelJeep.rotation - 90, 0, 1.0f, 0);
    glCallList(g_pModelJeep.call_identifier);

    // Flip the front- and backbuffer
    glutSwapBuffers();
}
Ejemplo n.º 3
0
Archivo: naev.c Proyecto: ekrumme/naev
/**
 * @brief Renders the game itself (player flying around and friends).
 *
 * Blitting order (layers):
 *   - BG
 *     - stars and planets
 *     - background player stuff (planet targetting)
 *     - background particles
 *     - back layer weapons
 *   - N
 *     - NPC ships
 *     - front layer weapons
 *     - normal layer particles (above ships)
 *   - FG
 *     - player
 *     - foreground particles
 *     - text and GUI
 */
static void render_all (void)
{
   double dt;

   dt = (paused) ? 0. : game_dt;

   /* setup */
   spfx_begin(dt);
   /* BG */
   space_render(dt);
   planets_render();
   weapons_render(WEAPON_LAYER_BG, dt);
   /* N */
   pilots_render(dt);
   weapons_render(WEAPON_LAYER_FG, dt);
   spfx_render(SPFX_LAYER_BACK);
   /* FG */
   player_render(dt);
   spfx_render(SPFX_LAYER_FRONT);
   space_renderOverlay(dt);
   spfx_end();
   gui_render(dt);
   display_fps( real_dt ); /* Exception. */
}
Ejemplo n.º 4
0
void game_render() {
	map_render();
	player_render();
	if(gamestate_current()==GAMESTATE_GAME)
		particle_emitter_loop();
}