mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-31 10:14:40 +03:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
149f5fbebc | ||
|
|
9ec8d8b637 | ||
|
|
8b8f827b70 | ||
|
|
a9ca63b367 | ||
|
|
345eca5e10 | ||
|
|
6930bde91b | ||
|
|
487e0c6b2d | ||
|
|
c636713a43 | ||
|
|
e3876feb3b | ||
|
|
d4425ed762 | ||
|
|
b0d2a6a372 | ||
|
|
ff611a56ff | ||
|
|
7d01c6bdb0 | ||
|
|
a990f8d87d | ||
|
|
6df7d5df8a | ||
|
|
64c554261e | ||
|
|
53d725f78a | ||
|
|
c20db02f15 | ||
|
|
dd15d67e62 | ||
|
|
a9d43b543f | ||
|
|
16d75d2da8 | ||
|
|
ff6bb68f3a | ||
|
|
4b2b4fb7c9 | ||
|
|
d678bd59ff | ||
|
|
ff785aaa8a | ||
|
|
3361e71036 | ||
|
|
4bba26280f | ||
|
|
217996b134 | ||
|
|
8640ead937 | ||
|
|
a9d438968d |
@@ -22,3 +22,4 @@ Last updated on January 23rd, 2024.
|
||||
| XBox One/UWP Port | [tunip3](https://github.com/tunip3) | Port for XBOX ONE (DURANGO) via UWP. | Permission is given to distribute a pre-compiled package (containing the data.zip assets) for people to run on development mode xboxes, for non commercial use only. | [github repo](https://github.com/tunip3/DURANGO-V6)|
|
||||
| armhf Port | [johnnyonFlame](https://github.com/johnnyonFlame/) | Armhf port for Raspberry PI and other SBC devices| Permission is for non commercial use only. Display the following text in the readme to make it clear that this is an exception: "VVVVVV is a commercial game! The author has given special permission to make this port available for free. If you enjoy the game, please consider purchasing a copy at [thelettervsixtim.es](http://thelettervsixtim.es)."| [github release](https://github.com/JohnnyonFlame/VVVVVV/releases/tag/v2.4-r1) |
|
||||
| Wii Port | [Alberto Mardegan](https://github.com/mardy/) | Port for the Nintendo Wii. | Permission is given to distribute a ready-to-use build for the Nintendo Wii containing the data.zip assets for non commercial use only. | [github repo](https://github.com/mardy/VVVVVV/tree/wii) |
|
||||
| Recalbox Port | [digitalLumberjack](https://gitlab.com/recalbox/recalbox) | Port for Recalbox project. | Display the following text in the readme to make it clear that this is an exception: "VVVVVV is a commercial game! The author has given special permission to make this port available for free. If you enjoy the game, please consider purchasing a copy at [thelettervsixtim.es](http://thelettervsixtim.es)." | [website](https://recalbox.com/) |
|
||||
|
||||
@@ -65,7 +65,7 @@ if(NOT WIN32)
|
||||
endif()
|
||||
|
||||
# Source Lists
|
||||
set(VVV_SRC
|
||||
set(VVV_CXX_SRC
|
||||
src/BinaryBlob.cpp
|
||||
src/BlockV.cpp
|
||||
src/ButtonGlyphs.cpp
|
||||
@@ -82,6 +82,7 @@ set(VVV_SRC
|
||||
src/Graphics.cpp
|
||||
src/GraphicsResources.cpp
|
||||
src/GraphicsUtil.cpp
|
||||
src/IMERender.cpp
|
||||
src/Input.cpp
|
||||
src/KeyPoll.cpp
|
||||
src/Labclass.cpp
|
||||
@@ -108,6 +109,8 @@ set(VVV_SRC
|
||||
src/WarpClass.cpp
|
||||
src/XMLUtils.cpp
|
||||
src/main.cpp
|
||||
)
|
||||
set(VVV_C_SRC
|
||||
src/DeferCallbacks.c
|
||||
src/GlitchrunnerMode.c
|
||||
src/Network.c
|
||||
@@ -120,12 +123,14 @@ set(VVV_SRC
|
||||
../third_party/physfs/extras/physfsrwops.c
|
||||
)
|
||||
if(STEAM)
|
||||
list(APPEND VVV_SRC src/SteamNetwork.c)
|
||||
list(APPEND VVV_C_SRC src/SteamNetwork.c)
|
||||
endif()
|
||||
if(GOG)
|
||||
list(APPEND VVV_SRC src/GOGNetwork.c)
|
||||
list(APPEND VVV_C_SRC src/GOGNetwork.c)
|
||||
endif()
|
||||
|
||||
set(VVV_SRC ${VVV_CXX_SRC} ${VVV_C_SRC})
|
||||
|
||||
# Executable information
|
||||
if(WIN32)
|
||||
add_executable(VVVVVV WIN32 ${VVV_SRC} icon.rc)
|
||||
@@ -208,35 +213,26 @@ set(SBIDI_SRC ../third_party/SheenBidi/Source/SheenBidi.c)
|
||||
if(NOT OFFICIAL_BUILD)
|
||||
# Add interim commit hash and its date to the build
|
||||
|
||||
# find_package sets GIT_FOUND and GIT_EXECUTABLE
|
||||
find_package(Git)
|
||||
# These filenames have to be qualified, because when we run
|
||||
# the CMake script, its work dir gets set to the build folder
|
||||
set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c)
|
||||
set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c)
|
||||
|
||||
if(GIT_FOUND)
|
||||
# These filenames have to be qualified, because when we run
|
||||
# the CMake script, its work dir gets set to the build folder
|
||||
set(VERSION_INPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.in.c)
|
||||
set(VERSION_OUTPUT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/InterimVersion.out.c)
|
||||
add_custom_command(
|
||||
# This OUTPUT line is required for this to be ran every time
|
||||
OUTPUT ${VERSION_OUTPUT_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/src/_dummy.c
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
# These args have to be passed through, otherwise the script can't see them
|
||||
# Also, these args have to come BEFORE `-P`! (Otherwise it fails with an unclear error)
|
||||
-DINPUT_FILE=${VERSION_INPUT_FILE}
|
||||
-DOUTPUT_FILE=${VERSION_OUTPUT_FILE}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
GenerateVersion ALL
|
||||
# This BYPRODUCTS line is required for this to be ran every time
|
||||
BYPRODUCTS ${VERSION_OUTPUT_FILE}
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
# These args have to be passed through, otherwise the script can't see them
|
||||
# Also, these args have to come BEFORE `-P`! (Otherwise it fails with an unclear error)
|
||||
-DGIT_EXECUTABLE=${GIT_EXECUTABLE}
|
||||
-DINPUT_FILE=${VERSION_INPUT_FILE}
|
||||
-DOUTPUT_FILE=${VERSION_OUTPUT_FILE}
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/version.cmake
|
||||
)
|
||||
target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS)
|
||||
|
||||
add_dependencies(VVVVVV GenerateVersion)
|
||||
|
||||
target_compile_definitions(VVVVVV PRIVATE -DINTERIM_VERSION_EXISTS)
|
||||
|
||||
add_library(InterimVersion STATIC src/InterimVersion.out.c)
|
||||
list(APPEND STATIC_LIBRARIES InterimVersion)
|
||||
endif()
|
||||
add_library(InterimVersion STATIC src/InterimVersion.out.c)
|
||||
list(APPEND STATIC_LIBRARIES InterimVersion)
|
||||
endif()
|
||||
|
||||
# Build options
|
||||
@@ -287,27 +283,37 @@ endif()
|
||||
if(MSVC)
|
||||
# MSVC doesn't have /std:c99 or /std:c++98 switches!
|
||||
|
||||
# Disable exceptions
|
||||
# MSVC does not officially support disabling exceptions,
|
||||
# so this is as far as we are willing to go to disable them.
|
||||
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS /EHsc)
|
||||
|
||||
# Disable RTTI
|
||||
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS /GR-)
|
||||
|
||||
if(MSVC_VERSION GREATER 1900)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
|
||||
endif()
|
||||
else()
|
||||
string(REGEX REPLACE "-std=[a-z0-9]+" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
|
||||
set_source_files_properties(${VVV_C_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
|
||||
|
||||
string(REGEX REPLACE "-std=[a-z0-9+]+" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
||||
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -std=c++98)
|
||||
|
||||
# Disable exceptions
|
||||
string(REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -fno-exceptions)
|
||||
|
||||
# Disable RTTI
|
||||
string(REPLACE "-frtti" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
set_source_files_properties(${VVV_CXX_SRC} PROPERTIES COMPILE_FLAGS -fno-rtti)
|
||||
|
||||
# Dependencies (as needed)
|
||||
set_source_files_properties(${FAUDIO_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
|
||||
set_source_files_properties(${CHM_SRC} PROPERTIES COMPILE_FLAGS -std=c99)
|
||||
endif()
|
||||
|
||||
# Unfortunately, it doesn't seem like distros package LodePNG
|
||||
|
||||
@@ -20,7 +20,7 @@ Contributors
|
||||
* Jules de Sartiges (@strikersh)
|
||||
* Keith Stellyes (@keithstellyes)
|
||||
* KyoZM (@lsaa)
|
||||
* leo60228 (@leo60228)
|
||||
* leo vriska (@leo60228)
|
||||
* MAO3J1m0Op (@MAO3J1m0Op)
|
||||
* Malte Grimm (@trelbutate)
|
||||
* Marvin Scholz (@ePirat)
|
||||
|
||||
@@ -58,7 +58,7 @@ Of course, when you remove strings without replacement, you can simply remove th
|
||||
These are the text printing functions:
|
||||
|
||||
font::print(flags, x, y, text, r, g, b)
|
||||
font::print(flags, x, y, text, r, g, b, linespacing = -1, maxwidth = -1)
|
||||
font::print_wrap(flags, x, y, text, r, g, b, linespacing = -1, maxwidth = -1)
|
||||
|
||||
The flags argument can be 0, or a set of flags that do things like centering, enlarging, etc.
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ static const char* githubfriends[] = {
|
||||
"Jules de Sartiges",
|
||||
"Keith Stellyes",
|
||||
"KyoZM",
|
||||
"leo60228",
|
||||
"leo vriska",
|
||||
"MAO3J1m0Op",
|
||||
"Malte Grimm",
|
||||
"Marvin Scholz",
|
||||
|
||||
@@ -251,6 +251,23 @@ static void levelMetaDataCallback(const char* filename)
|
||||
}
|
||||
}
|
||||
|
||||
static void unloadZips(void)
|
||||
{
|
||||
char** list = PHYSFS_getSearchPath();
|
||||
if (list == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (char** path = list; *path != NULL; path++)
|
||||
{
|
||||
if (SDL_strncmp(*path, "levels/", 7) == 0 && endsWith(*path, ".zip"))
|
||||
{
|
||||
PHYSFS_unmount(*path);
|
||||
}
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
}
|
||||
|
||||
void customlevelclass::getDirectoryData(void)
|
||||
{
|
||||
|
||||
@@ -258,6 +275,8 @@ void customlevelclass::getDirectoryData(void)
|
||||
|
||||
FILESYSTEM_clearLevelDirError();
|
||||
|
||||
unloadZips();
|
||||
|
||||
loadZips();
|
||||
|
||||
FILESYSTEM_enumerateLevelDirFileNames(levelMetaDataCallback);
|
||||
|
||||
@@ -2105,6 +2105,7 @@ static void input_submitted(void)
|
||||
|
||||
ed.levx = SDL_clamp(help.Int(coord_x) - 1, 0, cl.mapwidth - 1);
|
||||
ed.levy = SDL_clamp(help.Int(coord_y) - 1, 0, cl.mapheight - 1);
|
||||
graphics.foregrounddrawn = false;
|
||||
graphics.backgrounddrawn = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1232,7 +1232,24 @@ static bool gridmatch( int p1, int p2, int p3, int p4, int p11, int p21, int p31
|
||||
|
||||
static void entityclonefix(entclass* entity)
|
||||
{
|
||||
if (entity->behave == 10 || entity->behave == 12)
|
||||
const bool is_lies_emitter = entity->behave == 10;
|
||||
const bool is_factory_emitter = entity->behave == 12;
|
||||
|
||||
const bool is_emitter = is_lies_emitter || is_factory_emitter;
|
||||
if (!is_emitter)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const bool in_lies_emitter_room =
|
||||
game.roomx >= 113 && game.roomx <= 117 && game.roomy == 111;
|
||||
const bool in_factory_emitter_room =
|
||||
game.roomx == 113 && game.roomy >= 108 && game.roomy <= 110;
|
||||
|
||||
const bool valid = (is_lies_emitter && in_lies_emitter_room)
|
||||
|| (is_factory_emitter && in_factory_emitter_room);
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
/* Fix memory leak */
|
||||
entity->behave = -1;
|
||||
|
||||
@@ -342,6 +342,7 @@ int FILESYSTEM_init(char *argvZero, char* baseDir, char *assetsPath, char* langD
|
||||
"\nor get it from the free Make and Play Edition.",
|
||||
NULL
|
||||
);
|
||||
VVV_exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -4728,7 +4728,13 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett
|
||||
|
||||
if (SDL_strcmp(pKey, "stretch") == 0)
|
||||
{
|
||||
screen_settings->scalingMode = help.Int(pText);
|
||||
int mode = help.Int(pText);
|
||||
if (mode < 0 || mode >= NUM_SCALING_MODES)
|
||||
{
|
||||
/* Pick a sane default. */
|
||||
mode = SCALING_INTEGER;
|
||||
}
|
||||
screen_settings->scalingMode = mode;
|
||||
}
|
||||
|
||||
if (SDL_strcmp(pKey, "useLinearFilter") == 0)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "FileSystemUtils.h"
|
||||
#include "Font.h"
|
||||
#include "GraphicsUtil.h"
|
||||
#include "IMERender.h"
|
||||
#include "Localization.h"
|
||||
#include "Map.h"
|
||||
#include "Maths.h"
|
||||
@@ -3517,11 +3518,19 @@ void Graphics::get_stretch_info(SDL_Rect* rect)
|
||||
rect->w = width;
|
||||
rect->h = height;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(0 && "Invalid scaling mode!");
|
||||
/* Width and height should be nonzero to avoid division by zero. */
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
rect->w = width;
|
||||
rect->h = height;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::render(void)
|
||||
{
|
||||
ime_render();
|
||||
draw_screenshot_border();
|
||||
|
||||
if (gameScreen.badSignalEffect)
|
||||
@@ -3534,10 +3543,12 @@ void Graphics::render(void)
|
||||
|
||||
draw_window_background();
|
||||
|
||||
SDL_Rect rect;
|
||||
get_stretch_info(&rect);
|
||||
SDL_Rect stretch_info;
|
||||
get_stretch_info(&stretch_info);
|
||||
|
||||
copy_texture(gameTexture, NULL, &rect, 0, NULL, flipmode ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE);
|
||||
ime_set_rect(&stretch_info);
|
||||
|
||||
copy_texture(gameTexture, NULL, &stretch_info, 0, NULL, flipmode ? SDL_FLIP_VERTICAL : SDL_FLIP_NONE);
|
||||
}
|
||||
|
||||
void Graphics::renderwithscreeneffects(void)
|
||||
|
||||
109
desktop_version/src/IMERender.cpp
Normal file
109
desktop_version/src/IMERender.cpp
Normal file
@@ -0,0 +1,109 @@
|
||||
#include <SDL.h>
|
||||
|
||||
#include "Constants.h"
|
||||
#include "Font.h"
|
||||
#include "Graphics.h"
|
||||
#include "KeyPoll.h"
|
||||
#include "UTF8.h"
|
||||
|
||||
static bool render_done = false;
|
||||
static SDL_Rect imebox;
|
||||
|
||||
void ime_render(void)
|
||||
{
|
||||
render_done = false;
|
||||
|
||||
if (!SDL_IsTextInputActive() || key.imebuffer == "")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int fontheight = font::height(PR_FONT_LEVEL);
|
||||
imebox.x = 8;
|
||||
imebox.y = SCREEN_HEIGHT_PIXELS - 32 - fontheight;
|
||||
imebox.w = font::len(PR_FONT_LEVEL, key.imebuffer.c_str()) + 1;
|
||||
imebox.h = fontheight + 1;
|
||||
|
||||
SDL_Rect imebox_border = imebox;
|
||||
imebox_border.x -= 1;
|
||||
imebox_border.y -= 1;
|
||||
imebox_border.w += 2;
|
||||
imebox_border.h += 2;
|
||||
|
||||
graphics.fill_rect(&imebox_border, 128, 128, 128);
|
||||
graphics.fill_rect(&imebox, 0, 0, 0);
|
||||
|
||||
if (key.imebuffer_length > 0)
|
||||
{
|
||||
/* Also show a selection, so we need to know where and how long it is...
|
||||
* Because SDL gives us the number of "characters" (so, codepoints)... */
|
||||
const char* imebuffer_ptr = key.imebuffer.c_str();
|
||||
const char* sel_start_ptr = imebuffer_ptr;
|
||||
for (int i = 0; i < key.imebuffer_start; i++)
|
||||
{
|
||||
if (UTF8_next(&sel_start_ptr) == 0)
|
||||
{
|
||||
// Already past the '\0'...
|
||||
sel_start_ptr--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const char* sel_end_ptr = sel_start_ptr;
|
||||
for (int i = 0; i < key.imebuffer_length; i++)
|
||||
{
|
||||
if (UTF8_next(&sel_end_ptr) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
size_t before_sel_nbytes = sel_start_ptr - imebuffer_ptr;
|
||||
size_t in_sel_nbytes = sel_end_ptr - sel_start_ptr;
|
||||
char* before_sel = (char*) SDL_malloc(before_sel_nbytes + 1);
|
||||
char* in_sel = (char*) SDL_malloc(in_sel_nbytes + 1);
|
||||
if (before_sel != NULL && in_sel != NULL)
|
||||
{
|
||||
SDL_memcpy(before_sel, imebuffer_ptr, before_sel_nbytes);
|
||||
before_sel[before_sel_nbytes] = '\0';
|
||||
SDL_memcpy(in_sel, sel_start_ptr, in_sel_nbytes);
|
||||
in_sel[in_sel_nbytes] = '\0';
|
||||
|
||||
int before_sel_pixels = font::len(PR_FONT_LEVEL, before_sel) - 1;
|
||||
int in_sel_pixels = font::len(PR_FONT_LEVEL, in_sel);
|
||||
if (in_sel_pixels > 0)
|
||||
{
|
||||
in_sel_pixels += 1;
|
||||
}
|
||||
|
||||
SDL_Rect selrect = imebox;
|
||||
selrect.x += before_sel_pixels + 1;
|
||||
selrect.w = in_sel_pixels;
|
||||
graphics.fill_rect(&selrect, 128, 64, 0);
|
||||
}
|
||||
SDL_free(before_sel);
|
||||
SDL_free(in_sel);
|
||||
}
|
||||
|
||||
font::print(PR_FONT_LEVEL | PR_CJK_LOW, imebox.x + 1, imebox.y + 1, key.imebuffer, 255, 255, 255);
|
||||
|
||||
render_done = true;
|
||||
}
|
||||
|
||||
void ime_set_rect(SDL_Rect* stretch_info)
|
||||
{
|
||||
if (!render_done)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Rect imebox_scaled = imebox;
|
||||
float x_scale = (float) stretch_info->w / SCREEN_WIDTH_PIXELS;
|
||||
float y_scale = (float) stretch_info->h / SCREEN_HEIGHT_PIXELS;
|
||||
imebox_scaled.x *= x_scale;
|
||||
imebox_scaled.y *= y_scale;
|
||||
imebox_scaled.w *= x_scale;
|
||||
imebox_scaled.h *= y_scale;
|
||||
imebox_scaled.x += stretch_info->x;
|
||||
imebox_scaled.y += stretch_info->y;
|
||||
|
||||
SDL_SetTextInputRect(&imebox_scaled);
|
||||
}
|
||||
7
desktop_version/src/IMERender.h
Normal file
7
desktop_version/src/IMERender.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef IMERENDER_H
|
||||
#define IMERENDER_H
|
||||
|
||||
void ime_render(void);
|
||||
void ime_set_rect(SDL_Rect* stretch_info);
|
||||
|
||||
#endif /* IMERENDER_H */
|
||||
@@ -2617,6 +2617,7 @@ void gameinput(void)
|
||||
|| !game.glitchrunkludge)
|
||||
{
|
||||
game.state++;
|
||||
game.unlockstate();
|
||||
}
|
||||
game.jumpheld = true;
|
||||
game.glitchrunkludge=true;
|
||||
|
||||
@@ -50,7 +50,10 @@ KeyPoll::KeyPoll(void)
|
||||
// 0..5
|
||||
sensitivity = 2;
|
||||
|
||||
keybuffer="";
|
||||
keybuffer = "";
|
||||
imebuffer = "";
|
||||
imebuffer_start = 0;
|
||||
imebuffer_length = 0;
|
||||
leftbutton=0; rightbutton=0; middlebutton=0;
|
||||
mousex = 0;
|
||||
mousey = 0;
|
||||
@@ -64,13 +67,19 @@ KeyPoll::KeyPoll(void)
|
||||
|
||||
void KeyPoll::enabletextentry(void)
|
||||
{
|
||||
keybuffer="";
|
||||
keybuffer = "";
|
||||
imebuffer = "";
|
||||
imebuffer_start = 0;
|
||||
imebuffer_length = 0;
|
||||
SDL_StartTextInput();
|
||||
}
|
||||
|
||||
void KeyPoll::disabletextentry(void)
|
||||
{
|
||||
SDL_StopTextInput();
|
||||
imebuffer = "";
|
||||
imebuffer_start = 0;
|
||||
imebuffer_length = 0;
|
||||
}
|
||||
|
||||
bool KeyPoll::textentry(void)
|
||||
@@ -321,6 +330,17 @@ void KeyPoll::Poll(void)
|
||||
keybuffer += evt.text.text;
|
||||
}
|
||||
break;
|
||||
case SDL_TEXTEDITING:
|
||||
imebuffer = evt.edit.text;
|
||||
imebuffer_start = evt.edit.start;
|
||||
imebuffer_length = evt.edit.length;
|
||||
break;
|
||||
case SDL_TEXTEDITING_EXT:
|
||||
imebuffer = evt.editExt.text;
|
||||
imebuffer_start = evt.editExt.start;
|
||||
imebuffer_length = evt.editExt.length;
|
||||
SDL_free(evt.editExt.text);
|
||||
break;
|
||||
|
||||
/* Mouse Input */
|
||||
case SDL_MOUSEMOTION:
|
||||
|
||||
@@ -69,6 +69,9 @@ public:
|
||||
bool textentry(void);
|
||||
bool pressedbackspace;
|
||||
std::string keybuffer;
|
||||
std::string imebuffer;
|
||||
int imebuffer_start;
|
||||
int imebuffer_length;
|
||||
|
||||
bool linealreadyemptykludge;
|
||||
|
||||
|
||||
@@ -835,7 +835,7 @@ void gamelogic(void)
|
||||
}
|
||||
}
|
||||
|
||||
if(obj.horplatforms)
|
||||
if (obj.horplatforms)
|
||||
{
|
||||
for (int ie = obj.entities.size() - 1; ie >= 0; ie--)
|
||||
{
|
||||
@@ -859,7 +859,10 @@ void gamelogic(void)
|
||||
//is the player standing on a moving platform?
|
||||
int i = obj.getplayer();
|
||||
float j = obj.entitycollideplatformfloor(i);
|
||||
if (INBOUNDS_VEC(i, obj.entities) && j > -1000)
|
||||
// To match 2.2, we need to give a bit of leeway in the lifeseq
|
||||
// before we start pushing the player.
|
||||
const bool horz_active = game.lifeseq < 8;
|
||||
if (horz_active && INBOUNDS_VEC(i, obj.entities) && j > -1000)
|
||||
{
|
||||
obj.entities[i].newxp = obj.entities[i].xp + j;
|
||||
obj.entitymapcollision(i);
|
||||
@@ -867,7 +870,7 @@ void gamelogic(void)
|
||||
else
|
||||
{
|
||||
j = obj.entitycollideplatformroof(i);
|
||||
if (INBOUNDS_VEC(i, obj.entities) && j > -1000)
|
||||
if (horz_active && INBOUNDS_VEC(i, obj.entities) && j > -1000)
|
||||
{
|
||||
obj.entities[i].newxp = obj.entities[i].xp + j;
|
||||
obj.entitymapcollision(i);
|
||||
|
||||
@@ -962,7 +962,7 @@ void musicclass::play(int t)
|
||||
m_doFadeInVol = false;
|
||||
m_doFadeOutVol = false;
|
||||
musicVolume = VVV_MAX_VOLUME;
|
||||
MusicTrack::SetVolume(musicVolume);
|
||||
MusicTrack::SetVolume(VVV_MAX_VOLUME * user_music_volume / USER_VOLUME_MAX);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#ifndef RELEASEVERSION_H
|
||||
#define RELEASEVERSION_H
|
||||
|
||||
#define RELEASE_VERSION "v2.4.1"
|
||||
#define RELEASE_VERSION "v2.4.2"
|
||||
|
||||
#endif /* RELEASEVERSION_H */
|
||||
|
||||
@@ -2135,9 +2135,21 @@ void gamecompleterender(void)
|
||||
creditOffset += 140;
|
||||
if (graphics.onscreen(creditOffset + position))
|
||||
{
|
||||
font::print(PR_2X | PR_CEN | PR_CJK_HIGH, -1, creditOffset + position, loc::gettext("Thanks for"), tr, tg, tb);
|
||||
const char* line1;
|
||||
const char* line2;
|
||||
if (graphics.flipmode)
|
||||
{
|
||||
line1 = loc::gettext("playing!");
|
||||
line2 = loc::gettext("Thanks for");
|
||||
}
|
||||
else
|
||||
{
|
||||
line1 = loc::gettext("Thanks for");
|
||||
line2 = loc::gettext("playing!");
|
||||
}
|
||||
font::print(PR_2X | PR_CEN | PR_CJK_HIGH, -1, creditOffset + position, line1, tr, tg, tb);
|
||||
creditOffset += 20;
|
||||
font::print(PR_2X | PR_CEN | PR_CJK_LOW, -1, creditOffset + position, loc::gettext("playing!"), tr, tg, tb);
|
||||
font::print(PR_2X | PR_CEN | PR_CJK_LOW, -1, creditOffset + position, line2, tr, tg, tb);
|
||||
}
|
||||
|
||||
draw_skip_message();
|
||||
|
||||
@@ -681,7 +681,7 @@ void scriptclass::run(void)
|
||||
texty = 0;
|
||||
textcrewmateposition.x = obj.entities[i].xp;
|
||||
textcrewmateposition.override_x = true;
|
||||
textcrewmateposition.y = obj.entities[i].xp;
|
||||
textcrewmateposition.y = obj.entities[i].yp;
|
||||
textcrewmateposition.override_y = true;
|
||||
|
||||
textcrewmateposition.dir = j;
|
||||
@@ -3547,7 +3547,7 @@ bool scriptclass::loadcustom(const std::string& t)
|
||||
}else if(words[0] == "reply"){
|
||||
//For this version, terminal only
|
||||
if(squeakmode==0) add("squeak(player)");
|
||||
add("text(cyan,0,0,"+words[1]+")");
|
||||
add("text(player,0,0,"+words[1]+")");
|
||||
|
||||
int ti=help.Int(words[1].c_str());
|
||||
int nti = ti>=0 ? ti : 1;
|
||||
|
||||
@@ -220,6 +220,12 @@ void vlog_open_console(void)
|
||||
vlog_error("Could not redirect STDERR to console.");
|
||||
}
|
||||
|
||||
handle = freopen("CON", "r", stdin);
|
||||
if (handle == NULL)
|
||||
{
|
||||
vlog_error("Could not redirect STDIN to console.");
|
||||
}
|
||||
|
||||
check_color_support();
|
||||
|
||||
if (!SetConsoleOutputCP(CP_UTF8))
|
||||
|
||||
@@ -363,6 +363,23 @@ static void emscriptenloop(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static void keep_console_open(const bool open_console)
|
||||
{
|
||||
if (!open_console)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Press ENTER to quit.");
|
||||
|
||||
int c;
|
||||
do
|
||||
{
|
||||
c = getchar();
|
||||
}
|
||||
while (c != '\n' && c != EOF);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
char* baseDir = NULL;
|
||||
@@ -370,9 +387,11 @@ int main(int argc, char *argv[])
|
||||
char* langDir = NULL;
|
||||
char* fontsDir = NULL;
|
||||
bool seed_use_sdl_getticks = false;
|
||||
#ifdef _WIN32
|
||||
bool open_console = false;
|
||||
#endif
|
||||
bool print_version = false;
|
||||
bool print_addresses = false;
|
||||
int invalid_arg = 0;
|
||||
int invalid_partial_arg = 0;
|
||||
|
||||
vlog_init();
|
||||
|
||||
@@ -386,41 +405,16 @@ int main(int argc, char *argv[])
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
vlog_error("%s option requires one argument.", argv[i]); \
|
||||
VVV_exit(1); \
|
||||
invalid_partial_arg = i; \
|
||||
}
|
||||
|
||||
if (ARG("-version"))
|
||||
{
|
||||
/* Just print the version and exit. No vlogging. */
|
||||
puts(
|
||||
"VVVVVV " RELEASE_VERSION
|
||||
#ifdef MAKEANDPLAY
|
||||
" [M&P]"
|
||||
#endif
|
||||
);
|
||||
#ifdef INTERIM_VERSION_EXISTS
|
||||
puts(COMMIT_DATE);
|
||||
puts(INTERIM_COMMIT);
|
||||
puts(BRANCH_NAME);
|
||||
#endif
|
||||
VVV_exit(0);
|
||||
print_version = true;
|
||||
}
|
||||
else if (ARG("-addresses"))
|
||||
{
|
||||
printf("cl : %p\n", (void*) &cl);
|
||||
printf("ed : %p\n", (void*) &ed);
|
||||
printf("game : %p\n", (void*) &game);
|
||||
printf("gameScreen : %p\n", (void*) &gameScreen);
|
||||
printf("graphics : %p\n", (void*) &graphics);
|
||||
printf("help : %p\n", (void*) &help);
|
||||
printf("key : %p\n", (void*) &key);
|
||||
printf("map : %p\n", (void*) &map);
|
||||
printf("music : %p\n", (void*) &music);
|
||||
printf("obj : %p\n", (void*) &obj);
|
||||
printf("script : %p\n", (void*) &script);
|
||||
|
||||
VVV_exit(0);
|
||||
print_addresses = true;
|
||||
}
|
||||
else if (ARG("-renderer"))
|
||||
{
|
||||
@@ -541,8 +535,7 @@ int main(int argc, char *argv[])
|
||||
#undef ARG
|
||||
else
|
||||
{
|
||||
vlog_error("Error: invalid option: %s", argv[i]);
|
||||
VVV_exit(1);
|
||||
invalid_arg = i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,7 +550,56 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
if (invalid_arg > 0)
|
||||
{
|
||||
vlog_error("Error: invalid option: %s", argv[invalid_arg]);
|
||||
keep_console_open(open_console);
|
||||
VVV_exit(1);
|
||||
}
|
||||
else if (invalid_partial_arg > 0)
|
||||
{
|
||||
vlog_error("%s option requires one argument.", argv[invalid_partial_arg]);
|
||||
keep_console_open(open_console);
|
||||
VVV_exit(1);
|
||||
}
|
||||
|
||||
if (print_version)
|
||||
{
|
||||
/* Just print the version and exit. No vlogging. */
|
||||
puts(
|
||||
"VVVVVV " RELEASE_VERSION
|
||||
#ifdef MAKEANDPLAY
|
||||
" [M&P]"
|
||||
#endif
|
||||
);
|
||||
#ifdef INTERIM_VERSION_EXISTS
|
||||
puts(COMMIT_DATE);
|
||||
puts(INTERIM_COMMIT);
|
||||
puts(BRANCH_NAME);
|
||||
#endif
|
||||
keep_console_open(open_console);
|
||||
VVV_exit(0);
|
||||
}
|
||||
else if (print_addresses)
|
||||
{
|
||||
printf("cl : %p\n", (void*) &cl);
|
||||
printf("ed : %p\n", (void*) &ed);
|
||||
printf("game : %p\n", (void*) &game);
|
||||
printf("gameScreen : %p\n", (void*) &gameScreen);
|
||||
printf("graphics : %p\n", (void*) &graphics);
|
||||
printf("help : %p\n", (void*) &help);
|
||||
printf("key : %p\n", (void*) &key);
|
||||
printf("map : %p\n", (void*) &map);
|
||||
printf("music : %p\n", (void*) &music);
|
||||
printf("obj : %p\n", (void*) &obj);
|
||||
printf("script : %p\n", (void*) &script);
|
||||
|
||||
keep_console_open(open_console);
|
||||
VVV_exit(0);
|
||||
}
|
||||
|
||||
SDL_SetHintWithPriority(SDL_HINT_IME_SHOW_UI, "1", SDL_HINT_OVERRIDE);
|
||||
SDL_SetHintWithPriority(SDL_HINT_IME_SUPPORT_EXTENDED_TEXT, "1", SDL_HINT_OVERRIDE);
|
||||
|
||||
/* We already do the button swapping in ButtonGlyphs, disable SDL's swapping */
|
||||
SDL_SetHintWithPriority(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, "0", SDL_HINT_OVERRIDE);
|
||||
@@ -774,6 +816,7 @@ int main(int argc, char *argv[])
|
||||
cl.ListOfMetaData.push_back(meta);
|
||||
} else {
|
||||
vlog_error("Level not found");
|
||||
keep_console_open(open_console);
|
||||
VVV_exit(1);
|
||||
}
|
||||
}
|
||||
@@ -824,9 +867,10 @@ int main(int argc, char *argv[])
|
||||
f_time = SDL_GetTicks64();
|
||||
|
||||
const Uint64 f_timetaken = f_time - f_timePrev;
|
||||
if (!game.over30mode && f_timetaken < 34)
|
||||
const int timestep = game.get_timestep();
|
||||
if (!game.over30mode && f_timetaken < (Uint64) timestep)
|
||||
{
|
||||
const volatile Uint64 f_delay = 34 - f_timetaken;
|
||||
const volatile Uint64 f_delay = timestep - f_timetaken;
|
||||
SDL_Delay((Uint32) f_delay);
|
||||
f_time = SDL_GetTicks64();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,42 @@
|
||||
# Expects INPUT_FILE and OUTPUT_FILE to be defined
|
||||
|
||||
# Get interim commit and date of commit
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h
|
||||
OUTPUT_VARIABLE INTERIM_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
# find_package sets GIT_FOUND and GIT_EXECUTABLE
|
||||
find_package(Git)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%cd --date=short
|
||||
OUTPUT_VARIABLE COMMIT_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
if(GIT_FOUND)
|
||||
# Get interim commit and date of commit
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%h
|
||||
OUTPUT_VARIABLE INTERIM_COMMIT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND "${GIT_EXECUTABLE}" branch --show-current
|
||||
OUTPUT_VARIABLE BRANCH_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" log -1 --format=%cd --date=short
|
||||
OUTPUT_VARIABLE COMMIT_DATE
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
MESSAGE(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE}) on branch ${BRANCH_NAME}")
|
||||
execute_process(
|
||||
COMMAND "${GIT_EXECUTABLE}" branch --show-current
|
||||
OUTPUT_VARIABLE BRANCH_NAME
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
# Defaults if we don't have git or its commands fail for any reason or give blanks
|
||||
# For annoying CMake reasons, must use "${VAR}" syntax rather than VAR
|
||||
if("${INTERIM_COMMIT}" STREQUAL "")
|
||||
set(INTERIM_COMMIT "(commit?)")
|
||||
endif()
|
||||
if("${COMMIT_DATE}" STREQUAL "")
|
||||
set(COMMIT_DATE "(date?)")
|
||||
endif()
|
||||
if("${BRANCH_NAME}" STREQUAL "")
|
||||
set(BRANCH_NAME "(branch?)")
|
||||
endif()
|
||||
|
||||
message(STATUS "This is interim commit ${INTERIM_COMMIT} (committed ${COMMIT_DATE}) on branch ${BRANCH_NAME}")
|
||||
|
||||
# Take the template file and replace the macros with what we have
|
||||
CONFIGURE_FILE(${INPUT_FILE} ${OUTPUT_FILE})
|
||||
configure_file(${INPUT_FILE} ${OUTPUT_FILE})
|
||||
|
||||
Reference in New Issue
Block a user