Fix wrong sounds option key, fix 'fly on' being two pixels too high

This commit is contained in:
UnknownShadow200 2018-10-30 15:21:09 +11:00
parent bdd37b98ab
commit 869064c5c7
4 changed files with 24 additions and 26 deletions

View File

@ -523,20 +523,20 @@ void Window_GetClipboardText(String* value) {
void Window_SetClipboardText(const String* value) { void Window_SetClipboardText(const String* value) {
PasteboardRef pbRef; PasteboardRef pbRef;
CFDataRef cfData; CFDataRef cfData;
char str[800];
int len;
OSStatus err; OSStatus err;
pbRef = Window_GetPasteboard(); pbRef = Window_GetPasteboard();
err = PasteboardClear(pbRef); err = PasteboardClear(pbRef);
if (err) ErrorHandler_Fail2(err, "Clearing Pasteboard"); if (err) ErrorHandler_Fail2(err, "Clearing Pasteboard");
PasteboardSynchronize(pbRef); PasteboardSynchronize(pbRef);
IntPtr ptr = Marshal.StringToHGlobalUni(value); len = Platform_ConvertString(str, value);
cfData = CFDataCreate(NULL, ptr, (value.Length + 1) * 2); CFDataCreate(NULL, str, len);
if (!cfData) ErrorHandler_Fail("CFDataCreate() returned null pointer"); if (!cfData) ErrorHandler_Fail("CFDataCreate() returned null pointer");
PasteboardPutItemFlavor(pbRef, 1, FMT_UTF16, cfData, 0); PasteboardPutItemFlavor(pbRef, 1, FMT_UTF8, cfData, 0);
Marshal.FreeHGlobal(ptr);
} }
/* TODO: IMPLEMENT void Window_SetIcon(Bitmap* bmp); */ /* TODO: IMPLEMENT void Window_SetIcon(Bitmap* bmp); */

View File

@ -604,14 +604,8 @@ void Window_ProcessEvents(void) {
if (e.xselectionrequest.selection == xa_clipboard && e.xselectionrequest.target == xa_utf8_string && clipboard_copy_text.length) { if (e.xselectionrequest.selection == xa_clipboard && e.xselectionrequest.target == xa_utf8_string && clipboard_copy_text.length) {
reply.xselection.property = Window_GetSelectionProperty(&e); reply.xselection.property = Window_GetSelectionProperty(&e);
uint8_t data[1024]; char str[800];
int i, len = 0; int len = Platform_ConvertString(str, &clipboard_copy_text);
for (i = 0; i < clipboard_copy_text.length; i++) {
uint8_t* cur = data + len;
Codepoint cp = Convert_CP437ToUnicode(clipboard_copy_text.buffer[i]);
len += Convert_UnicodeToUtf8(cp, cur);
}
XChangeProperty(win_display, reply.xselection.requestor, reply.xselection.property, xa_utf8_string, 8, XChangeProperty(win_display, reply.xselection.requestor, reply.xselection.property, xa_utf8_string, 8,
PropModeReplace, data, len); PropModeReplace, data, len);

View File

@ -13,7 +13,7 @@ extern const char* FpsLimit_Names[FPS_LIMIT_COUNT];
#define OPT_USE_MUSIC "usemusic" #define OPT_USE_MUSIC "usemusic"
#define OPT_USE_SOUND "usesound" #define OPT_USE_SOUND "usesound"
#define OPT_MUSIC_VOLUME "musicvolume" #define OPT_MUSIC_VOLUME "musicvolume"
#define OPT_SOUND_VOLUME "soundvolume" #define OPT_SOUND_VOLUME "soundsvolume"
#define OPT_FORCE_OPENAL "forceopenal" #define OPT_FORCE_OPENAL "forceopenal"
#define OPT_FORCE_OLD_OPENGL "force-oldgl" #define OPT_FORCE_OLD_OPENGL "force-oldgl"

View File

@ -363,23 +363,27 @@ static void StatusScreen_ContextLost(void* screen) {
} }
static void StatusScreen_ContextRecreated(void* screen) { static void StatusScreen_ContextRecreated(void* screen) {
static String chars = String_FromConst("0123456789-, ()");
static String prefix = String_FromConst("Position: ");
struct StatusScreen* s = screen; struct StatusScreen* s = screen;
String chars = String_FromConst("0123456789-, ()");
String prefix = String_FromConst("Position: ");
struct TextWidget* status = &s->Status; struct TextWidget* status = &s->Status;
struct TextWidget* hacks = &s->HackStates;
int y;
y = 2;
TextWidget_Make(status); TextWidget_Make(status);
Widget_SetLocation(status, ANCHOR_MIN, ANCHOR_MIN, 2, 2); Widget_SetLocation(status, ANCHOR_MIN, ANCHOR_MIN, 2, y);
status->ReducePadding = true; status->ReducePadding = true;
StatusScreen_Update(s, 1.0); StatusScreen_Update(s, 1.0);
int elemHeight = status->Height + 2; y += status->Height;
TextAtlas_Make(&s->PosAtlas, &chars, &s->Font, &prefix); TextAtlas_Make(&s->PosAtlas, &chars, &s->Font, &prefix);
s->PosAtlas.Tex.Y = elemHeight; s->PosAtlas.Tex.Y = y;
struct TextWidget* hacks = &s->HackStates; y += s->PosAtlas.Tex.Height;
TextWidget_Make(hacks); TextWidget_Make(hacks);
Widget_SetLocation(hacks, ANCHOR_MIN, ANCHOR_MIN, 2, elemHeight * 2); Widget_SetLocation(hacks, ANCHOR_MIN, ANCHOR_MIN, 2, y);
hacks->ReducePadding = true; hacks->ReducePadding = true;
StatusScreen_UpdateHackState(s); StatusScreen_UpdateHackState(s);
} }