diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 7f0c85e..8396e1e 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -104,7 +104,7 @@ set(src_win32lib ./redalert/win32lib/wwstd.h ./redalert/win32lib/ww_win.h ./redalert/win32lib/_diptabl.cpp - "redalert/ffmpegmovie.cpp") + "redalert/ffmpegmovie.cpp" "redalert/briefing.cpp") #Red Alert files set(src_redalert @@ -730,7 +730,7 @@ if (UNIX) add_definitions(-D RA_AF -DCHEAT_KEYS -DIMGUI_IMPL_OPENGL_LOADER_GLEW -DSCENARIO_EDITOR -DTRUE_FALSE_DEFINED -DENGLISH -D_USRDLL -DREDALERT_EXPORTS) endif(UNIX) -add_executable(RedAlert ${src_io} ${src_win32lib} ${src_redalert} ${src_external} "redalert/light.cpp") +add_executable(RedAlert ${src_io} ${src_win32lib} ${src_redalert} ${src_external} "redalert/light.cpp" "redalert/briefing.cpp") if (MSVC) set_target_properties(RedAlert PROPERTIES OUTPUT_NAME "RedAlert" LINK_FLAGS "/PDB:\"RedAlert.pdb\" /SUBSYSTEM:WINDOWS" RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/../" ) diff --git a/code/redalert/briefing.cpp b/code/redalert/briefing.cpp new file mode 100644 index 0000000..7b45cf1 --- /dev/null +++ b/code/redalert/briefing.cpp @@ -0,0 +1,29 @@ +// briefing.cpp +// + +#include "function.h" +#include "image.h" + +void RenderBriefing(void) { + Image_t* worldMapImage = Image_LoadImage("ui/briefing/generic_worldmap.png"); + bool exitBreifing = false; + while (!exitBreifing) { + // Check for any new SDL events. + SDL_Event event; + while (SDL_PollEvent(&event)) { + if (event.type == SDL_KEYDOWN) { + //delete raw_image_buffer; + exitBreifing = true; + break; + } + } + + UserInput.Process_Input(); + + GL_RenderImage(worldMapImage, 0, 0, ScreenWidth, ScreenHeight); + GL_DrawText(5, 32.0f, 255.0f, 255.0f, 255.0f, 20, 0, Scen.Description); + GL_DrawText(5, 20.0f, 255.0f, 255.0f, 255.0f, 60, 30, Scen.BriefingText); + GL_DrawText(5, 20, 255.0f, 255.0f, 255.0f, (ScreenWidth / 2) - 100, ScreenHeight - 40, "Press any key to continue"); + Device_Present(); + } +} \ No newline at end of file diff --git a/code/redalert/function.h b/code/redalert/function.h index 80a15fd..d22e0b1 100644 --- a/code/redalert/function.h +++ b/code/redalert/function.h @@ -1199,6 +1199,8 @@ struct Image_t; void Sys_SetOverlayImage(Image_t* image); int Sys_Milliseconds(void); +void RenderBriefing(void); + extern bool g_inMainMenu; extern KeyNumType g_globalKeyNumType; extern int g_globalKeyFlags; diff --git a/code/redalert/newblit.cpp b/code/redalert/newblit.cpp index 527938e..010c016 100644 --- a/code/redalert/newblit.cpp +++ b/code/redalert/newblit.cpp @@ -151,6 +151,14 @@ void GL_DrawText(int color, int x, int y, char* text) { ImGui::GetBackgroundDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(ImVec4(r, g, b, 1)), text); } +void GL_DrawText(int color, float fontsize, float r, float g, float b, int x, int y, char* text) { + ImVec2 pos(x, y); + float _r = r / 255.0f; + float _g = r / 255.0f; + float _b = r / 255.0f; + ImGui::GetBackgroundDrawList()->AddText(NULL, fontsize, pos, ImGui::ColorConvertFloat4ToU32(ImVec4(_r, _g, _b, 1)), text); +} + void GL_DrawForegroundText(int color, int x, int y, char* text) { ImVec2 pos(x, y); if (color == 0 || color == 160) { // This is a hack! diff --git a/code/redalert/newblit.h b/code/redalert/newblit.h index 5c1b748..4225c2e 100644 --- a/code/redalert/newblit.h +++ b/code/redalert/newblit.h @@ -22,4 +22,5 @@ void GL_ForceForegroundRender(bool force); void GL_DrawForegroundText(int color, int x, int y, char* text); void GL_SetColor(float r, float g, float b); void GL_SetRenderTexture(RenderTexture* renderTexture); -void GL_EnableBlend(GLBlendType blendType); \ No newline at end of file +void GL_EnableBlend(GLBlendType blendType); +void GL_DrawText(int color, float fontsize, float r, float g, float b, int x, int y, char* text); \ No newline at end of file diff --git a/code/redalert/scenario.cpp b/code/redalert/scenario.cpp index fabcc02..a9a2d3b 100644 --- a/code/redalert/scenario.cpp +++ b/code/redalert/scenario.cpp @@ -64,6 +64,7 @@ #include "tcpip.h" #include "ccdde.h" #include "audiomix.h" +#include "image.h" extern bool SpawnedFromWChat; #endif @@ -402,26 +403,7 @@ bool Start_Scenario(char * name, bool briefing) */ if (!Debug_SkipBriefing) { - char buffer[25]; - if (Scen.BriefMovie != VQ_NONE) { - sprintf(buffer, "%s.VQA", VQName[Scen.BriefMovie]); - } - if (Session.Type == GAME_NORMAL && (Scen.BriefMovie == VQ_NONE || !CCFileClass(buffer).Is_Available())) { - /* - ** Make sure the mouse is visible before showing the restatement. - */ - while (Get_Mouse_State()) { - Show_Mouse(); - } - Restate_Mission(Scen.ScenarioName, TXT_OK, TXT_NONE); - } - - if (briefing) { - Hide_Mouse(); - VisiblePage.Clear(); - Show_Mouse(); - Play_Movie(Scen.ActionMovie, Scen.TransitTheme); - } + RenderBriefing(); } if (Scen.TransitTheme == THEME_NONE) { diff --git a/scripts/SCU01EA.INI.script b/scripts/SCU01EA.INI.script index f728e94..a1df232 100644 --- a/scripts/SCU01EA.INI.script +++ b/scripts/SCU01EA.INI.script @@ -2,7 +2,7 @@ require("_Global") function map_briefing() PlayMovie("SOVIET1") - SetBriefingText("Welcome Comrade General! Here in Alaska we will be begin our glorous conquest!") + SetBriefingText("Objective 1: Capture the allied communication center.\nObjective 2: Ensure your engineers dont die.\nObjective 3: Ensure your radar domes survive.\n") end function map_start() diff --git a/ui/briefing/generic_worldmap.png b/ui/briefing/generic_worldmap.png new file mode 100644 index 0000000..5828625 Binary files /dev/null and b/ui/briefing/generic_worldmap.png differ