Merge pull request #16 from Clownacy/master
Merge Clownacy/master into master
This commit is contained in:
commit
82dc512539
9 changed files with 232 additions and 231 deletions
|
@ -338,6 +338,9 @@ else()
|
||||||
# Compile it ourselves
|
# Compile it ourselves
|
||||||
message(STATUS "Using local SDL2")
|
message(STATUS "Using local SDL2")
|
||||||
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
|
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
|
||||||
|
if(MSVC)
|
||||||
|
set(LIBC ON) # Needed to prevent possible 'symbol already defined' errors
|
||||||
|
endif()
|
||||||
add_subdirectory("external/SDL2" EXCLUDE_FROM_ALL)
|
add_subdirectory("external/SDL2" EXCLUDE_FROM_ALL)
|
||||||
target_link_libraries(CSE2 SDL2-static SDL2main)
|
target_link_libraries(CSE2 SDL2-static SDL2main)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -107,6 +107,9 @@ void activatejoy(Fl_Widget*, void*){
|
||||||
joystuffcontainer->activate();
|
joystuffcontainer->activate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned int button_lookup[8] = {0, 1, 2, 5, 3, 4, 6, 7};
|
||||||
|
|
||||||
void read_Config(){
|
void read_Config(){
|
||||||
std::fstream fd;
|
std::fstream fd;
|
||||||
fd.open("Config.dat", std::ios::in | std::ios::binary);
|
fd.open("Config.dat", std::ios::in | std::ios::binary);
|
||||||
|
@ -135,7 +138,7 @@ void read_Config(){
|
||||||
for(char i=0;i<8;i++){
|
for(char i=0;i<8;i++){
|
||||||
const unsigned long button = CharsToLong(config.buttons[i]);
|
const unsigned long button = CharsToLong(config.buttons[i]);
|
||||||
if(button<9 && button>0){
|
if(button<9 && button>0){
|
||||||
joyRows[i]->value(button -1);
|
joyRows[button_lookup[i]]->value(button-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,7 +151,7 @@ void write_Config(Fl_Widget*, void*){
|
||||||
LongToChars(displaychoice->value(), config.display);
|
LongToChars(displaychoice->value(), config.display);
|
||||||
LongToChars(joychoice->value(), config.useJoy);
|
LongToChars(joychoice->value(), config.useJoy);
|
||||||
for(char i =0;i<8;i++){
|
for(char i =0;i<8;i++){
|
||||||
LongToChars(joyRows[i]->value(), config.buttons[i]);
|
LongToChars(joyRows[button_lookup[i]]->value()+1, config.buttons[i]);
|
||||||
}
|
}
|
||||||
std::fstream fd;
|
std::fstream fd;
|
||||||
fd.open("Config.dat", std::ios::out | std::ios::binary);
|
fd.open("Config.dat", std::ios::out | std::ios::binary);
|
||||||
|
|
|
@ -489,10 +489,8 @@ bool SystemTask()
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// BUG FIX: Pixel relied on key codes for input, but these differ based on keyboard layout.
|
// BUG FIX: Pixel relied on key codes for input, but these differ based on keyboard layout.
|
||||||
//This would break the alternate movement keys on typical English keyboards, since the '=' key
|
// This would break the alternate movement keys on typical English keyboards, since the '=' key is in a completely different place to where it is on a Japanese keyboard.
|
||||||
//is in a completely different place to where it is on a Japanese keyboard.
|
// To solve this, we use scancodes instead, which are based on the physical location of keys, rather than their meaning.
|
||||||
//To solve this, we use scancodes instead, which are based on the physical location of keys,
|
|
||||||
//rather than their meaning.
|
|
||||||
switch (event.key.keysym.scancode)
|
switch (event.key.keysym.scancode)
|
||||||
{
|
{
|
||||||
case SDL_SCANCODE_ESCAPE:
|
case SDL_SCANCODE_ESCAPE:
|
||||||
|
|
|
@ -52,8 +52,7 @@ BOOL LoadMapData2(const char *path_map)
|
||||||
fread(&dum, 1, 1, fp);
|
fread(&dum, 1, 1, fp);
|
||||||
// Get width and height
|
// Get width and height
|
||||||
#ifdef NONPORTABLE
|
#ifdef NONPORTABLE
|
||||||
// This fails on big-endian hardware, and platforms
|
// This fails on big-endian hardware, and platforms where short is not two bytes long.
|
||||||
// where short is not two bytes long.
|
|
||||||
fread(&gMap.width, 2, 1, fp);
|
fread(&gMap.width, 2, 1, fp);
|
||||||
fread(&gMap.length, 2, 1, fp);
|
fread(&gMap.length, 2, 1, fp);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -14,7 +14,7 @@ void ReadyMapName(const char *str)
|
||||||
{
|
{
|
||||||
int a;
|
int a;
|
||||||
|
|
||||||
//Handle "Studio Pixel presents" text in the intro
|
// Handle "Studio Pixel presents" text in the intro, using an obfuscated string
|
||||||
unsigned char presentText[24] = {
|
unsigned char presentText[24] = {
|
||||||
#ifdef JAPANESE
|
#ifdef JAPANESE
|
||||||
// "ŠJ”ŽºPixel presents"
|
// "ŠJ”ŽºPixel presents"
|
||||||
|
@ -79,12 +79,11 @@ void ReadyMapName(const char *str)
|
||||||
str = (char*)presentText;
|
str = (char*)presentText;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy map's name to the MapName
|
// Copy map's name to the global map name
|
||||||
strcpy(gMapName.name, str);
|
strcpy(gMapName.name, str);
|
||||||
|
|
||||||
// Draw the text to the surface
|
// Draw the text to the surface
|
||||||
a = (int)strlen(gMapName.name);
|
a = (int)strlen(gMapName.name);
|
||||||
|
|
||||||
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
CortBox2(&rc, 0, SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((160 - 6 * a) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * a) / 2 + 6, 1, gMapName.name, RGB(0x11, 0x00, 0x22), SURFACE_ID_ROOM_NAME);
|
||||||
PutText2((160 - 6 * a) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
PutText2((160 - 6 * a) / 2 + 6, 0, gMapName.name, RGB(0xFF, 0xFF, 0xFE), SURFACE_ID_ROOM_NAME);
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <SDL_rwops.h>
|
|
||||||
#include <SDL_thread.h>
|
#include <SDL_thread.h>
|
||||||
#include <SDL_timer.h>
|
#include <SDL_timer.h>
|
||||||
#include <SDL_events.h>
|
#include <SDL_events.h>
|
||||||
|
|
Loading…
Add table
Reference in a new issue