litchie / exult-ios Goto Github PK
View Code? Open in Web Editor NEWExult ( http://exult.sourceforge.net/ )
License: GNU General Public License v2.0
Exult ( http://exult.sourceforge.net/ )
License: GNU General Public License v2.0
Do you think it would be possible to replace the "Exit" in the main menu with "Exult Homepage" or "Help" that will open up safari with our homepage or our forum or our documentation page?
And which of those do you think are more appropriate?
When you enable AC, the shortcut bar doesn't get updated and is still in the now out of visibility black screen until you restart.
If you had AC enabled and you toggle it off, the Shortcut bar doesn't get moved ot the top of the screen but remains where it was with AC.
the dpad works only for a couple of steps and stalls until you touch it again
I think a big source of some shortcut bar problems is that it is created in exult.cc while it should just be in gamewin.cc.
The example of the previous keyboardgump was maybe misleading because that gump was supposed to be visible all the time, including the Exult menu etc.
This opens another set of problems, though:
My patch for this is at http://pastebin.com/WaMUQMBK (and pasted here as well - I have no idea how to make a pullrequest from a project I'm a member of).
diff --git a/exult.cc b/exult.cc
index 4422fdf..d4beb7c 100644
--- a/exult.cc
+++ b/exult.cc
@@ -743,7 +743,6 @@ int exult_main(const char *runpath) {
#endif
#ifdef __IPHONEOS__
- g_shortcutBar = new ShortcutBar_gump(0,0);
touchui->showGameControls();
#endif
@@ -1462,8 +1461,8 @@ static void Handle_event(
Touchscreen->handle_event(&event);
#endif
#ifdef __IPHONEOS__
- if (g_shortcutBar->handle_event(&event))
- break;
+ //if (g_shortcutBar->handle_event(&event))
+ // break;
#endif
int x, y;
gwin->get_win()->screen_to_game(event.button.x, event.button.y, gwin->get_fastmouse(), x, y);
@@ -1597,8 +1596,8 @@ static void Handle_event(
Mouse::mouse->set_speed_cursor();
}
#ifdef __IPHONEOS__
- if (g_shortcutBar->handle_event(&event))
- break;
+ //if (g_shortcutBar->handle_event(&event))
+ // break;
#endif
// Last click within .5 secs?
if (curtime - last_b1_click < 500 &&
@@ -1856,8 +1855,8 @@ static int Get_click(
Touchscreen->handle_event(&event);
#endif
#ifdef __IPHONEOS__
- if (g_shortcutBar->handle_event(&event))
- break;
+ //if (g_shortcutBar->handle_event(&event))
+ // break;
#endif
if (event.button.button == 3)
rightclick = true;
@@ -1874,8 +1873,8 @@ static int Get_click(
Touchscreen->handle_event(&event);
#endif
#ifdef __IPHONEOS__
- if (g_shortcutBar->handle_event(&event))
- break;
+ //if (g_shortcutBar->handle_event(&event))
+ // break;
#endif
if (event.button.button == 1) {
gwin->get_win()->screen_to_game(event.button.x, event.button.y, gwin->get_fastmouse(), x, y);
diff --git a/gamerend.cc b/gamerend.cc
index b36a94c..be751b6 100644
--- a/gamerend.cc
+++ b/gamerend.cc
@@ -539,10 +539,6 @@ void Game_window::paint_dirty() {
#ifdef UNDER_CE
gkeyboard->paint();
#endif
-#ifdef __IPHONEOS__
- if (g_shortcutBar)
- g_shortcutBar->paint();
-#endif
}
/*
diff --git a/gamewin.cc b/gamewin.cc
index ab3d553..50c39b4 100644
--- a/gamewin.cc
+++ b/gamewin.cc
@@ -88,6 +88,9 @@
#include "monstinf.h"
#include "usefuns.h"
#include "audio/midi_drivers/XMidiFile.h"
+#ifdef __IPHONEOS__
+# include "iphone_gumps.h"
+#endif
#ifdef USE_EXULTSTUDIO
#include "server.h"
@@ -2890,7 +2893,8 @@ void Game_window::setup_game(
painted = true; // Main loop uses this.
gump_man->close_all_gumps(true); // Kill gumps.
Face_stats::load_config(config);
-
+ ShortcutBar_gump *g_shortcutBar;
+ g_shortcutBar = new ShortcutBar_gump(0,0);
// Set palette for time-of-day.
clock->reset();
clock->set_palette();
diff --git a/gumps/Gump_manager.cc b/gumps/Gump_manager.cc
index 88a1400..4fc98e8 100644
--- a/gumps/Gump_manager.cc
+++ b/gumps/Gump_manager.cc
@@ -431,11 +431,6 @@ void Gump_manager::paint(bool modal) {
#ifdef UNDER_CE
gkeyboard->paint();
#endif
-#ifdef __IPHONEOS__
- if (g_shortcutBar) {
- g_shortcutBar->paint();
- }
-#endif
}
@@ -462,7 +457,7 @@ int Gump_manager::handle_modal_gump_event(
int gx, gy;
Uint16 keysym_unicode = 0;
-
+ ShortcutBar_gump *g_shortcutBar;
switch (event.type) {
#ifdef UNDER_CE
case SDL_ACTIVEEVENT:
diff --git a/gumps/iphone_gumps.cc b/gumps/iphone_gumps.cc
index 179bca5..f54ba84 100644
--- a/gumps/iphone_gumps.cc
+++ b/gumps/iphone_gumps.cc
@@ -293,11 +293,13 @@ ShortcutBar_gump::ShortcutBar_gump(int placex, int placey)
locy = placey;
createButtons();
+ gumpman->add_gump(this);
}
ShortcutBar_gump::~ShortcutBar_gump()
{
deleteButtons();
+ gumpman->close_gump(this);
}
void ShortcutBar_gump::paint()
I think that's code from the previous ios porting, but when you single click anything some kind of menu pops up. I think that's rather annoying :)
But it could make sense on the smaller idevices screens. No idea how feasible it is to implement this only for smaller devices.
Definitely needs to go away on ipad size.
I wonder if we support that.
Judging from the below commit to Dospad and @paultzirides report in #27 , I doubt we do.
litchie/dospad@369b82d
Since you cannot exit an iOS app, Exult needs to do away with various ways to exit
When you open the savegame gump and select an existing savegame, instantly the name change iphone keyboard pops up and you need to hit cancel when you just want to load this save.
I have no idea if that can be made to work differently, maybe it can be first selected and then on another click/tap pop up the keyboard.
I was wondering what is up with iOS' CoreAudio Midi. It's disabled for iPhone and even though I messed a bit around I couldn't get it to compile when I enabled it.
I noticed that you disabled CoreAudio in DOSPad so I wanted to ask what the matter is with it? it's not really needed and the FMOpl emu is probably much better in performance and I have no idea what the Midi sounds like on iOS, I just wanted to know :)
The iOS settings gump could control the color of the shortcut buttons outline or disable it.
I think it might be a good idea to use the quicksave feature when closing/switching from Exult.
When playing it would need to recognize the switch (I think that's possible in SDL) then execute our quicksave action (via keyboard it would be ctrl-s, I can't look at the code right now to look up the function).
When starting Exult again, the quicksave is loaded on "continue onward".
With fix for issue #35, it's apparent that dragging an item onto the shortcut bar is behaving as if you clicked a button on it. This shouldn't be.
Probably needs a check for dragging item in the iphone_gumps.cc
The prompt in the NPC tool and its subscreens needs to be back on the bottom. Screen is too full :(
Will try to fix it.
When you cast Wizard Eye, you should be able to use the spell view like you normally use the Avatar. But it is not reacting to the d-pad.
Right now only the quicksave works because you cannot enter a name for a savegame.
Now "empty slot" disappears and gives way to a prompt. The keyboard should come up now.
I've added an option setting to change the dpad screen layout in e80eb4f with the dpad being set to left, right and disabled.
Looking at the GameControl code, I don't see how to start to actually make this happen.
in 939dfd5 I added the possibility to auto-pathfind when touching with a finger longer than 500 ms. When you release the finger I added a growing circular animation (it's a spell effect from the original game).
It would be better to have this animation while holding the finger to signal that the long touch has registered.
But this would need another timer on the SDL_MOUSEBUTTONDOWN event, similar to the one done in gumps/ShortcutBar_gump.cc (https://github.com/litchie/exult-ios/blob/master/gumps/ShortcutBar_gump.cc#L370 and further).
But that is over my head.
The cheatscreen (cheat_screen.cc) needs a text input mode as well.
I'm currently working on cramping the text in the upper half of the screen, so a keyboard will not overlap the text.
It might be nice if the keyboard only comes up when you tap the screen and when you change cheatscreen screens it disappears again until you tap again.
Since we always auto-open the keyboard after Return closes it, the iOS 11 keyboard isn‘t closeable anymore.
The notebook gump needs a manual closing button.
Also the help menu needs to be disabled in notebook mode.
the virtual d-pad only moves up/down/left/right and not the in between directions.
When aspect correction is enabled the shortcut bar overlaps the Save gump (gump/Newfile_gump.cc) on first appearance of the save gump.
When you click on the save gump below the shortcut bar, the shortcut bar vanishes but the place where the shortcut bar buttons are normally, is not useable for interaction with the Save gump.
To reproduce:
Except for the menu gump, every other gump that gets closed by the ESC button doesn't restore the virtual gamepad.
Examples:
I think for a touch interface we need a shortcut bar. Exult is very driven by shortcuts even though most stuff (except for the cheats) can be done by clicking through several stuff.
Need to think about which shortcuts would be best.
There are many different types of pointers, arrows, fingers. I am wondering if we need to keep them on iOS.
when you change resolutions or enable aspect correction (which you kind of need to do on an iPhone - on an iPad aspect is fine with a top bar) the clicks don't align properly with the buttons anymore.
I've dabbled a bit in the position of the bar to make it auto align with the top, regardless of resolution and aspect correction state.
Currently I have this:
void ShortcutBar_gump::createButtons()
{
int x = 0;
int starty = gwin->get_win()->get_start_y();
int endy = gwin->get_win()->get_end_y();
int resy = gwin->get_win()->get_full_height();
int gamey = gwin->get_game_height();
y = 20+starty;
....
....
buttonItems[i].rect = new Rectangle(x, y, barItemWidth, height);
But it needs more work as I didn't realize it wouldn't auto align unless I restarted Exult, so with these ints above it might be, should be, possible to come to an auto alignment, I hope.
When you leave the d-pad on the right it can "overlap" talking points and thus prevent you cliking on them.
Solution: hide d-pad when talking.
I hacked around this by adding SDL_StartTextInput(); after hitting Return see 35f5399#diff-ae7b187c51fe5883955c1d666172cdf3R664
But this makes the iOS keyboard flicker since it stops and starts Textinput.
My guess is that this is an iOS code issue that it sees Return as some kind of done with input.
To test, start a game and click on the notebook on the right side of the shortcut bar.
I'm not showing on the contribution graph and my contributions are sort of showing as attributed to "lanica" when I look at "blame". Unfortunately, "lanica" is registered to someone else on github.
in SDL mercurial, some iOS changes landed. I wonder if they are relevant for exult-ios
https://forums.libsdl.org/viewtopic.php?t=11174&sid=73b40a20ff9a31a2156542dc2076cc5f
The jawbone's upper left pixels are glowing, I need to use another color for that part.
the menu button is dead after first use, seems it doesn't register when the menu gump is closed again.
There are some changes to the SDL 2.0.3 code done to make Exult work on iOS. Preferably these changes should be done in our code to make SDL just a drop in.
AFAICT by looking at other projects it might be possible to do this via the SDLUIKitDelegate subclassing I added in 84c7732.
A good example is the iOS port of GemRB and their Cocoawrapper which also uses an SDLUIKITDelegate subclass. See https://github.com/gemrb/gemrb/tree/master/apple/CocoaWrapper/ios
In iPad branch, we have the nice GUI movement buttons (which map to the numpad).
The GUI movement buttons disappear when we open any GUMPS window.
However, in options we can set "game pause when GUMPS open" to be disabled/false.
But GUI movement buttons still disappear when we open any GUMPS window (but game is still running).
Building with XCode Version 9.0 (9A235)
Error message:
msgfile.cc:34:10: 'ios_state.hpp' file not found
The shortcut bar needs some kind of auto updating when things change (similar to the face_stats).
I've got two savegames of Serpent Isle for testing the item changes:
https://www.dropbox.com/s/br1vcfxikgfklog/exult01si.sav?dl=0 which has spellbook, keyring, jawbone in front of the avatar, for easy adding to the inventory
https://www.dropbox.com/s/id7gyvxkt3dws6n/exult02si.sav?dl=0 has them already added
That item menu pop up (/gumps/iphone_gumps.cc/h) is sometimes not all the way on the screen and can therefore not be canceled.
Bad bad bug!
When you have aspect correction enabled the shortcut bar hovers "in" the game.
Now, grab any item and drag it over any button
-> the action of the button will start and when you end this, the item is gone. For example, drag it over the notebook button, the notebook will open, close the notebook with ESC -> item gone.
I think that's one of the reason the face_stats gump is checking for dragging (the other that you can drag'n'drop an item to the face).
The Notebook gump (gump/Notebook_gump.cc) needs text input if possible.
we need the data folder in the itunes file sharing as well, to throw in the music/sfx files and the mt32 roms :)
When trying to fly the magic carpet west, it goes southwest instead. When flying east, it goes southeast instead. North/south functions normally, but I constantly have to make nothernly course corrections to compensate for the carpet's movement
I'll add a savegame later
Thanks a lot. It's working already and I had some fun messing with things.
Do you want to "hear" all the issues? :)
Nice work, enjoyed running it!
The gamepad hiding and showing is not working correctly for both BG and SI. I'll investigate
changing anything in the resolutions loses dpad and menu.
By default, all touches will be translated into mouse events (left button). But U7 needs right click to navigate around. I am thinking that there will be a toggle button at the bottom of screen. When you turn it on, touch events will be treated as right clicks.
Another question: is mouse over event important in game playing?
The ESC button is quite useful and should maybe be separate from the gamepad when hiding. The gamepad is almost always in the way when gumps are on the screen but the ESC button is just in the way of the savegame gump.
So if they are separate it gives more control.
(I might be able to do that on my own - just adding to the list so I don't forget)
e12c5bc make Exult crash on loading a savegame.
Steps to reproduce:
Something in the cleaning up of the gump is crashing according to Xcode.
This is a bit over the top, since Exult only needs the flx files.
very minor issue, though :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.