Giter Site home page Giter Site logo

litchie / exult-ios Goto Github PK

View Code? Open in Web Editor NEW
42.0 7.0 8.0 51.26 MB

Exult ( http://exult.sourceforge.net/ )

License: GNU General Public License v2.0

C++ 31.91% C 51.22% Objective-C 2.66% Makefile 0.30% Shell 1.66% UnrealScript 4.24% CMake 0.53% HTML 4.32% Java 0.68% Perl 0.20% Python 0.01% Objective-C++ 0.03% CSS 0.03% TeX 0.54% LLVM 0.04% Inno Setup 0.07% Batchfile 0.01% Yacc 0.20% M4 1.29% Roff 0.06%

exult-ios's Issues

messed up on iPhone 4 + iOS 7

Tried it with an iphone 4, which is limited to iOS 7.
The startup screen is messed up on that.
Seems it can't tell that it should be in landscape mode:
exultios7

Is it limited to iOS 8 (or rather should we limit it to iOS 8)?

dpad stutters

the dpad works only for a couple of steps and stalls until you touch it again

Shortcut bar - change owner to gamewin (gamewin.cc)

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:

  • NO interaction possible yet with the shortcut bar
  • in the SDL_MOUSEUP/DOWN events in exult.cc, I needed to comment the shortcut bar stuff out or it would crash badly when clicking on the shortcut bar.
    • crash on loading a game is back

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()

Remove single click pop up

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.

singleclick

handle various ways to exit Exult

Since you cannot exit an iOS app, Exult needs to do away with various ways to exit

  • when no game files are detected, there is a screen telling you that and on next mouse event Exult normally exits. On iOS it ends with a black screen. So it shouldn't try to exit and just keep on showing this until you end the app
  • exit from the main menu (maybe remove this from iOS app main menu)
  • quit from the in game gump (maybe remove this from the gump on iOS)

Savegame gump and instant name change keyboard popup

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.

CoreAudio MIDI?

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 :)

Quicksave when switching from Exult

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".

Wizard Eye spell not "moveable"

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.

Keyboard needed for savegame names

Right now only the quicksave works because you cannot enter a name for a savegame.

  • hit menu
  • hit "Load/Save game"
  • click on "Empty Slot"

Now "empty slot" disappears and gives way to a prompt. The keyboard should come up now.

Change GameControl screen layout

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.

Long touch circular animation *while* touching

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.

Cheat screen - needs text input

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.

Notebook gump can‘t be closed in iOS 11

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.

Shortcut bar overlaps Save gump

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:

  • enable aspect correction in the graphics options (and restart Exult, due to #29 )
  • open the Save gump
  • click anywhere below the overlapping shortcut bar
  • try to click on "Empty slot" in the Save gump

ESC button doesn't restore the virtual gamepad sometimes

Except for the menu gump, every other gump that gets closed by the ESC button doesn't restore the virtual gamepad.
Examples:

  • double click the Avatar, paperdoll opebs, hit ESC, gamepad is missing. If you close the gump with the checkmark, gamepad shows.
  • click any of the buttons in the shortcut bar that open a gump (backpack, spellbook, map, jawbone (SI), notebook) -> same as above.

Shortcut bar

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.

Shortcut bar - changing resolution, enabling aspect correction messes click location

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.

My contributions

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.

De-hardcode SDL2 changes

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

REQUEST: GUI quickkeys & HUD

  1. HUD, such as compass coordinates, and watch time, and total gold, assuming we have picked up the items to display them. If you used iPad/Android, it's very tedious having to open the character, open bag, then find compass/watch/abacus.
  2. HUD quick buttons to access cheats or bag inventory for each player.

non pausing GUMPs still clears GUI movement controls

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).

Shortcut bar - update on new items, combat, resolution changes

The shortcut bar needs some kind of auto updating when things change (similar to the face_stats).

  • change of resolution leaves the shortcut bar invisible until you restart Exult. The clicks seem to fit the position the buttons should be at
  • some buttons only work (e.g. from greyed out shape to color shape) when the item is in the party. The shortcut bar needs a restart of Exult to show these changes
  • combat button should change according to the state of combat. IF combat is enabled then the flaming sword, if disabled the pigeon. In gumps/misc_buttons.cc there is already code for this https://github.com/litchie/exult-ios/blob/master/gumps/misc_buttons.cc#L97

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

Item loss with shortcut bar

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).

Magic carpet is not moving correctly in west/east

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

so far so good

Thanks a lot. It's working already and I had some fun messing with things.
Do you want to "hear" all the issues? :)

  • the menu button is dead after first use
  • the dpad works only for a couple of steps and stalls until you touch it again
  • on iPhone 5s (ios 8.1.2) the keyboard did not come up when starting a new game of Serpent Isle. It seems as if the keyboard popup hangs - but looking at the code changes, I see you have not done the same changes to gamemgr/sigame.cc as you've done to gamemgr/bggame.cc :)
  • we need the data folder in the itunes file sharing as well, to throw in the music/sfx files and the mt32 roms :)
  • changing anything in the resolutions loses dpad and menu. But it was interesting to see how high the resolution can go with xbr4 on an ipad (3rd gen). Unplayable but looking great :)
  • 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 :)

Nice work, enjoyed running it!

how to implement mouse right click behavior

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?

separate gamepad and btn1 from touchui->hideGameControls()

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.