mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 19:13:07 +01:00
fix intro with new drawing
This commit is contained in:
@@ -30,8 +30,9 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "../../config.h"
|
||||
#include "../drawing.h"
|
||||
#include "../../interface/window.h"
|
||||
#include "../../intro.h"
|
||||
#include "../drawing.h"
|
||||
}
|
||||
|
||||
class OpenGLDrawingEngine;
|
||||
@@ -175,13 +176,17 @@ public:
|
||||
glTranslatef(-1.0f, -1.0f, 0);
|
||||
glScalef(2.0f / _width, 2.0f / _height, 0);
|
||||
|
||||
window_update_all_viewports();
|
||||
gfx_redraw_screen_rect(0, 0, _width - 1, _height - 1);
|
||||
window_update_all();
|
||||
if (gIntroState != INTRO_STATE_NONE) {
|
||||
intro_draw(&_bitsDPI);
|
||||
} else {
|
||||
window_update_all_viewports();
|
||||
gfx_redraw_screen_rect(0, 0, _width - 1, _height - 1);
|
||||
window_update_all();
|
||||
|
||||
gfx_draw_pickedup_peep(&_bitsDPI);
|
||||
gfx_draw_pickedup_peep(&_bitsDPI);
|
||||
|
||||
rct2_draw(&_bitsDPI);
|
||||
rct2_draw(&_bitsDPI);
|
||||
}
|
||||
Display();
|
||||
}
|
||||
|
||||
@@ -278,6 +283,7 @@ IDrawingEngine * OpenGLDrawingContext::GetEngine()
|
||||
|
||||
void OpenGLDrawingContext::Clear(uint32 colour)
|
||||
{
|
||||
FillRect(colour, _clipLeft, _clipTop, _clipRight, _clipBottom);
|
||||
}
|
||||
|
||||
void OpenGLDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
|
||||
@@ -23,8 +23,9 @@
|
||||
extern "C"
|
||||
{
|
||||
#include "../../config.h"
|
||||
#include "../drawing.h"
|
||||
#include "../../interface/window.h"
|
||||
#include "../../intro.h"
|
||||
#include "../drawing.h"
|
||||
}
|
||||
|
||||
class SoftwareDrawingEngine;
|
||||
@@ -290,23 +291,27 @@ public:
|
||||
|
||||
void Draw() override
|
||||
{
|
||||
_rainDrawer.SetDPI(&_bitsDPI);
|
||||
_rainDrawer.Restore();
|
||||
if (gIntroState != INTRO_STATE_NONE) {
|
||||
intro_draw(&_bitsDPI);
|
||||
} else {
|
||||
_rainDrawer.SetDPI(&_bitsDPI);
|
||||
_rainDrawer.Restore();
|
||||
|
||||
// Redraw dirty regions before updating the viewports, otherwise
|
||||
// when viewports get panned, they copy dirty pixels
|
||||
DrawAllDirtyBlocks();
|
||||
// Redraw dirty regions before updating the viewports, otherwise
|
||||
// when viewports get panned, they copy dirty pixels
|
||||
DrawAllDirtyBlocks();
|
||||
|
||||
window_update_all_viewports();
|
||||
DrawAllDirtyBlocks();
|
||||
window_update_all();
|
||||
window_update_all_viewports();
|
||||
DrawAllDirtyBlocks();
|
||||
window_update_all();
|
||||
|
||||
gfx_draw_pickedup_peep(&_bitsDPI);
|
||||
gfx_invalidate_pickedup_peep();
|
||||
gfx_draw_pickedup_peep(&_bitsDPI);
|
||||
gfx_invalidate_pickedup_peep();
|
||||
|
||||
DrawRain(&_bitsDPI, &_rainDrawer);
|
||||
DrawRain(&_bitsDPI, &_rainDrawer);
|
||||
|
||||
rct2_draw(&_bitsDPI);
|
||||
rct2_draw(&_bitsDPI);
|
||||
}
|
||||
Display();
|
||||
}
|
||||
|
||||
|
||||
134
src/intro.c
134
src/intro.c
@@ -41,14 +41,11 @@ static bool _chainLiftFinished;
|
||||
static void screen_intro_process_mouse_input();
|
||||
static void screen_intro_process_keyboard_input();
|
||||
static void screen_intro_skip_part();
|
||||
static void screen_intro_draw_logo();
|
||||
static void screen_intro_draw_logo(rct_drawpixelinfo *dpi);
|
||||
|
||||
// rct2: 0x0068E966
|
||||
void intro_update()
|
||||
{
|
||||
rct_drawpixelinfo *screenDPI = &gScreenDPI;
|
||||
int screenWidth = gScreenWidth;
|
||||
|
||||
screen_intro_process_mouse_input();
|
||||
screen_intro_process_keyboard_input();
|
||||
|
||||
@@ -58,7 +55,7 @@ void intro_update()
|
||||
// Originally used for the disclaimer text
|
||||
gIntroState = INTRO_STATE_PUBLISHER_BEGIN;
|
||||
case INTRO_STATE_PUBLISHER_BEGIN:
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
load_palette();
|
||||
|
||||
// Set the Y for the Infogrammes logo
|
||||
_introStateCounter = -580;
|
||||
@@ -72,23 +69,8 @@ void intro_update()
|
||||
// Move the Infogrammes logo down
|
||||
_introStateCounter += 5;
|
||||
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
|
||||
// Draw a white rectangle for the logo background (gives a bit of white margin)
|
||||
gfx_fill_rect(screenDPI,
|
||||
(screenWidth / 2) - 320 + 50, _introStateCounter + 50,
|
||||
(screenWidth / 2) - 320 + 50 + 540, _introStateCounter + 50 + 425,
|
||||
BORDER_COLOUR_PUBLISHER);
|
||||
|
||||
// Draw Infogrames logo
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_INFOGRAMES_00, (screenWidth / 2) - 320 + 69, _introStateCounter + 69, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_INFOGRAMES_10, (screenWidth / 2) - 320 + 319, _introStateCounter + 69, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_INFOGRAMES_01, (screenWidth / 2) - 320 + 69, _introStateCounter + 319, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_INFOGRAMES_11, (screenWidth / 2) - 320 + 319, _introStateCounter + 319, 0);
|
||||
|
||||
// Check if logo is off the screen...ish
|
||||
if (_introStateCounter > gScreenHeight - 120) {
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
_introStateCounter = -116;
|
||||
gIntroState++;
|
||||
}
|
||||
@@ -96,8 +78,6 @@ void intro_update()
|
||||
break;
|
||||
case INTRO_STATE_DEVELOPER_BEGIN:
|
||||
_introStateCounter += 5;
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_DEVELOPER, 255);
|
||||
|
||||
// Set the Y for the Chris Sawyer logo
|
||||
_introStateCounter = -116;
|
||||
@@ -106,11 +86,6 @@ void intro_update()
|
||||
break;
|
||||
case INTRO_STATE_DEVELOPER_SCROLL:
|
||||
_introStateCounter += 5;
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
|
||||
// Draw Chris Sawyer logo
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_CHRIS_SAWYER_00, (screenWidth / 2) - 320 + 70, _introStateCounter, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_CHRIS_SAWYER_10, (screenWidth / 2) - 320 + 320, _introStateCounter, 0);
|
||||
|
||||
// Check if logo is almost scrolled to the bottom
|
||||
if (!_chainLiftFinished && _introStateCounter >= gScreenHeight + 40 - 421) {
|
||||
@@ -128,10 +103,6 @@ void intro_update()
|
||||
|
||||
// Check if logo is off the screen...ish
|
||||
if (_introStateCounter >= gScreenHeight + 40) {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 0);
|
||||
|
||||
screen_intro_draw_logo();
|
||||
|
||||
// Stop the track friction sound
|
||||
if (_soundChannel != NULL) {
|
||||
Mixer_Stop_Channel(_soundChannel);
|
||||
@@ -148,14 +119,10 @@ void intro_update()
|
||||
case INTRO_STATE_LOGO_FADE_IN:
|
||||
// Fade in, add 4 / 256 to fading
|
||||
_introStateCounter += 0x400;
|
||||
if (_introStateCounter <= 0xFF00) {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, (_introStateCounter >> 8) & 0xFF);
|
||||
} else {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 255);
|
||||
if (_introStateCounter > 0xFF00) {
|
||||
gIntroState++;
|
||||
_introStateCounter = 0;
|
||||
}
|
||||
screen_intro_draw_logo();
|
||||
break;
|
||||
case INTRO_STATE_LOGO_WAIT:
|
||||
// Wait 80 game ticks
|
||||
@@ -166,23 +133,15 @@ void intro_update()
|
||||
|
||||
gIntroState++;
|
||||
}
|
||||
screen_intro_draw_logo();
|
||||
break;
|
||||
case INTRO_STATE_LOGO_FADE_OUT:
|
||||
// Fade out, subtract 4 / 256 from fading
|
||||
_introStateCounter -= 0x400;
|
||||
if (_introStateCounter >= 0) {
|
||||
// Do palette thing
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, (_introStateCounter >> 8) & 0xFF);
|
||||
} else {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 0);
|
||||
if (_introStateCounter < 0) {
|
||||
gIntroState = INTRO_STATE_CLEAR;
|
||||
}
|
||||
screen_intro_draw_logo();
|
||||
break;
|
||||
case INTRO_STATE_CLEAR:
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_DARK);
|
||||
|
||||
// Stop any playing sound
|
||||
if (_soundChannel != NULL) {
|
||||
Mixer_Stop_Channel(_soundChannel);
|
||||
@@ -201,6 +160,74 @@ void intro_update()
|
||||
}
|
||||
}
|
||||
|
||||
void intro_draw(rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int screenWidth = gScreenWidth;
|
||||
|
||||
switch (gIntroState) {
|
||||
case INTRO_STATE_DISCLAIMER_1:
|
||||
case INTRO_STATE_DISCLAIMER_2:
|
||||
break;
|
||||
case INTRO_STATE_PUBLISHER_BEGIN:
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_DARK);
|
||||
break;
|
||||
case INTRO_STATE_PUBLISHER_SCROLL:
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_DARK);
|
||||
|
||||
// Draw a white rectangle for the logo background (gives a bit of white margin)
|
||||
gfx_fill_rect(dpi,
|
||||
(screenWidth / 2) - 320 + 50, _introStateCounter + 50,
|
||||
(screenWidth / 2) - 320 + 50 + 540, _introStateCounter + 50 + 425,
|
||||
BORDER_COLOUR_PUBLISHER);
|
||||
|
||||
// Draw Infogrames logo
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_00, (screenWidth / 2) - 320 + 69, _introStateCounter + 69, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_10, (screenWidth / 2) - 320 + 319, _introStateCounter + 69, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_01, (screenWidth / 2) - 320 + 69, _introStateCounter + 319, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_INFOGRAMES_11, (screenWidth / 2) - 320 + 319, _introStateCounter + 319, 0);
|
||||
break;
|
||||
case INTRO_STATE_DEVELOPER_BEGIN:
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_DARK);
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_DEVELOPER, 255);
|
||||
break;
|
||||
case INTRO_STATE_DEVELOPER_SCROLL:
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_DARK);
|
||||
|
||||
// Draw Chris Sawyer logo
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_CHRIS_SAWYER_00, (screenWidth / 2) - 320 + 70, _introStateCounter, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_CHRIS_SAWYER_10, (screenWidth / 2) - 320 + 320, _introStateCounter, 0);
|
||||
|
||||
// Check if logo is off the screen...ish
|
||||
if (_introStateCounter >= gScreenHeight + 40) {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 0);
|
||||
screen_intro_draw_logo(dpi);
|
||||
}
|
||||
break;
|
||||
case INTRO_STATE_LOGO_FADE_IN:
|
||||
if (_introStateCounter <= 0xFF00) {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, (_introStateCounter >> 8) & 0xFF);
|
||||
} else {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 255);
|
||||
}
|
||||
screen_intro_draw_logo(dpi);
|
||||
break;
|
||||
case INTRO_STATE_LOGO_WAIT:
|
||||
screen_intro_draw_logo(dpi);
|
||||
break;
|
||||
case INTRO_STATE_LOGO_FADE_OUT:
|
||||
if (_introStateCounter >= 0) {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, (_introStateCounter >> 8) & 0xFF);
|
||||
} else {
|
||||
gfx_transpose_palette(PALETTE_G1_IDX_LOGO, 0);
|
||||
}
|
||||
screen_intro_draw_logo(dpi);
|
||||
break;
|
||||
case INTRO_STATE_CLEAR:
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_DARK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void screen_intro_process_mouse_input()
|
||||
{
|
||||
if (gCursorState.any == CURSOR_PRESSED) {
|
||||
@@ -233,18 +260,17 @@ static void screen_intro_skip_part()
|
||||
}
|
||||
}
|
||||
|
||||
static void screen_intro_draw_logo()
|
||||
static void screen_intro_draw_logo(rct_drawpixelinfo *dpi)
|
||||
{
|
||||
rct_drawpixelinfo *screenDPI = &gScreenDPI;
|
||||
sint32 screenWidth = gScreenWidth;
|
||||
sint32 imageWidth = 640;
|
||||
sint32 imageX = (screenWidth - imageWidth) / 2;
|
||||
|
||||
gfx_clear(screenDPI, BACKROUND_COLOUR_LOGO);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_00, imageX + 0, 0, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_10, imageX + 220, 0, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_20, imageX + 440, 0, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_01, imageX + 0, 240, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_11, imageX + 220, 240, 0);
|
||||
gfx_draw_sprite(screenDPI, SPR_INTRO_LOGO_21, imageX + 440, 240, 0);
|
||||
gfx_clear(dpi, BACKROUND_COLOUR_LOGO);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_00, imageX + 0, 0, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_10, imageX + 220, 0, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_20, imageX + 440, 0, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_01, imageX + 0, 240, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_11, imageX + 220, 240, 0);
|
||||
gfx_draw_sprite(dpi, SPR_INTRO_LOGO_21, imageX + 440, 240, 0);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#ifndef _INTRO_H_
|
||||
#define _INTRO_H_
|
||||
|
||||
#include "drawing/drawing.h"
|
||||
|
||||
enum INTRO_STATE {
|
||||
INTRO_STATE_NONE,
|
||||
INTRO_STATE_PUBLISHER_BEGIN,
|
||||
@@ -35,5 +37,6 @@ enum INTRO_STATE {
|
||||
extern uint8 gIntroState;
|
||||
|
||||
void intro_update();
|
||||
void intro_draw(rct_drawpixelinfo *dpi);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user