Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Stoddard

Pages: 1 [2]
16
XPiratez / Stoddard's X-Piratez playmix - now on top of OXCE 3.3
« on: September 08, 2016, 05:42:30 am »
Rebase in progress, playmix builds not available until further notice.


This lists my patches on top of Meridian's branch, the set I actually play. This would be the topic for tracking most of my work on OpenXcom.

More-or-less up-to-date version of all of it merged is at https://github.com/StoddardOXC/OpenXcom/tree/playmix
The patches are kept mergeable with Meridian's branch in separate branches with similar names.
Linux builds are available at the usual place https://lxnt.wtf/oxem , prefix=playmix.

64-bit windows build now is available there too, playmix-e53bc0b-2016-10-01-j6-win64.7z

Dlls required for the windows build are in dlls.zip / dlls.7z . Put them beside the executable.

  • 16 bases
  • Basescape hotkeys
  • Follow5 - geoscape following a selected ufo
  • Mouse9 - bind any of up to 32 mouse buttons to the drag scroll
  • getoffmywm - don't ever touch window placement

16 bases enables 16 bases. When over 7 bases, just click on an unbuilt base in the base interface to build the next one.

Basescape hotkeys binds hotkeys to base interface buttons: Research, Manufacture, etc. It also binds the same hotkey to the cancel/exit button in the first screen that opens, so a quick look can be had by just pressing the hotkey twice.

Follow5 - Ctrl-click the 'Center on UFO - time 5 secs' button in the ufo info window for the geoscape view to follow the ufo.

Mouse9  - extended-functionality button to assign drag scroll. Click to bind, Ctrl-click (any buttton) to disable.

getoffmywm - when the display mode is set to 'Resizable', do not ever touch window positioning. (Other than that, the 'Resizable' mode does nothing). Gets rid of annoying recentering of the game window at each options dialog close, which is especially infuriating when you have more that one monitor. Also the window appears consistently in the same position when your WM handles this. (probably Linux-only).


17
XPiratez / Follow5 patch
« on: September 05, 2016, 01:56:48 am »
Another bit backported to current Meridian branch state.

https://vid.me/xuDv

Ctrl-click on "Center on ufo, time 5 secs" and view starts following the ufo. Handy for crash terrain selection.

https://github.com/MeridianOXC/OpenXcom/compare/oxce3.0-plus-proto...StoddardOXC:follow5

18
XPiratez / Mouse9 Patch
« on: September 05, 2016, 12:40:40 am »
Allows binding of any mouse button (up to 32rd)  to drag scroll.

Fixes the old problem of drag scroll being stuck on button release and ditches ugly workarounds for it.

https://vid.me/orId

https://github.com/MeridianOXC/OpenXcom/compare/oxce3.0-plus-proto...StoddardOXC:mouse9


19
Programming / Static code analysis
« on: September 04, 2016, 03:15:50 am »
Results are at https://lxnt.wtf/sca/

oxc- means SupSuper's repo
oxem- means Meridian's repo

clang is clang-llvm scan-build tool

callcatcher reports methods that aren't called

cppcheck is older and cargo-culty, and doesn't  add much substantial info.

Some of the result are false positives, the tools have their limitations.

Basically I want to assign 9th mouse button to drag-scroll and can't, since SDL1.2' s SDL_GetMouseState() is limited to 8, so it's either move to SDL2 or reimplement SDL_GetMouseState() to support more that 8.

I went with the latter, but still was very frustrated refactoring code only to discover that it was sitting unused for like 3 years already, and that was very time consuming.

To cut down on work, dead code should be eliminated. Callcatcher helps with this. Clang shows mostly non-obvious call graph paths that might result in a crash, this might help in pinning down if someone reports one.


20
Programming / Code question
« on: August 28, 2016, 11:06:01 pm »
Can someone please explain what are the

Code: [Select]
if (_game->getSavedGame()->getMonthsPassed() != -1)
checks all around the codebase mean?


21
XPiratez / 16B Patch
« on: August 17, 2016, 12:35:44 am »
While hammering away on my Geoscape AI project I got sick of being bitten in the ass with the 8-base limitation.

The AI in the current form just doesn't forgive any interception, and if the base responsible was in detection range of faction being intercepted, and if they have particularly bitter hangover at the moment (which they usually do), and they have enough forces at the ready, there goes your base. So bases became that much more disposable. Just hope the crackdown is detected so you can cheat and transfer all the stuff away (to be fixed, so that you won't be able to do that in a couple of clicks :) ). Also I'm experimenting with reducing detection range in favor of scan frequency. This obviously raises number of bases needed.

Long story short, here's a minimal patch extending max number of bases  to 16.

After you build 9th base, the 'NEW HIDEOUT' button is replaced by the second row of bases. To build more, click on an empty base slot.

The click works before that too.
12B

I guess a ruleset setting is needed instead of hardcoded constants like 8 or 16.

I got lost in git right now, so here's the patch if anyone's interested:

Spoiler:
diff --git a/src/Basescape/BasescapeState.cpp b/src/Basescape/BasescapeState.cpp
index 76738cd..3988e12 100644
--- a/src/Basescape/BasescapeState.cpp
+++ b/src/Basescape/BasescapeState.cpp
@@ -68,7 +68,13 @@ BasescapeState::BasescapeState(Base *base, Globe *globe) : _base(base), _globe(g
        https:// Create objects
        _txtFacility = new Text(192, 9, 0, 0);
        _view = new BaseView(192, 192, 0, 8);
+       if ( _game->getSavedGame()->getBases()->size() > MiniBaseView::ROW_BASES) {
+               _mini = new MiniBaseView(128, 32, 192, 38);
+       }
+       else
+       {
        _mini = new MiniBaseView(128, 16, 192, 41);
+       }
        _edtBase = new TextEdit(this, 127, 17, 193, 0);
        _txtLocation = new Text(126, 9, 194, 16);
        _txtFunds = new Text(126, 9, 194, 24);
@@ -203,8 +209,7 @@ void BasescapeState::init()
        }
 
        _txtFunds->setText(tr("STR_FUNDS").arg(Text::formatFunding(_game->getSavedGame()->getFunds())));
-
-       _btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() < MiniBaseView::MAX_BASES);
+       _btnNewBase->setVisible(_game->getSavedGame()->getBases()->size() <= MiniBaseView::ROW_BASES);
 }
 
 /**
@@ -480,7 +485,7 @@ void BasescapeState::viewMouseOut(Action *)
  * Selects a new base to display.
  * @param action Pointer to an action.
  */
-void BasescapeState::miniLeftClick(Action *)
+void BasescapeState::miniLeftClick(Action *unused)
 {
        size_t base = _mini->getHoveredBase();
        if (base < _game->getSavedGame()->getBases()->size())
@@ -488,13 +493,17 @@ void BasescapeState::miniLeftClick(Action *)
                _base = _game->getSavedGame()->getBases()->at(base);
                init();
        }
+       else
+       {
+               btnNewBaseClick(unused);
+       }
 }
 
 /**
  * Opens a dialog to make the selected base your HQ.
  * @param action Pointer to an action.
  */
-void BasescapeState::miniRightClick(Action *)
+void BasescapeState::miniRightClick(Action *unused)
 {
        size_t baseIndex = _mini->getHoveredBase();
 @@ -510,6 +519,10 @@ void BasescapeState::miniRightClick(Action *)
                        _game->pushState(new ChangeHeadquartersState(_game->getSavedGame()->getBases()->at(baseIndex)));
                }
        }
+       else
+       {
+               btnNewBaseClick(unused);
+       }
 }
 
 /**
diff --git a/src/Basescape/MiniBaseView.cpp b/src/Basescape/MiniBaseView.cpp
index 0ab1e4a..973197b 100644
--- a/src/Basescape/MiniBaseView.cpp
+++ b/src/Basescape/MiniBaseView.cpp
@@ -94,18 +94,20 @@ void MiniBaseView::draw()
        Surface::draw();
        for (size_t i = 0; i < MAX_BASES; ++i)
        {
+               int cell_x = (i % ROW_BASES) * (MINI_SIZE + 2);
+               int cell_y = (i / ROW_BASES) * (MINI_SIZE + 2);
                https:// Draw base squares
                if (i == _base)
                {
                        SDL_Rect r;
-                       r.x = i * (MINI_SIZE + 2);
-                       r.y = 0;
+                       r.x = cell_x;
+                       r.y = cell_y;
                        r.w = MINI_SIZE + 2;
                        r.h = MINI_SIZE + 2;
                        drawRect(&r, 1);
                }
-               _texture->getFrame(41)->setX(i * (MINI_SIZE + 2));
-               _texture->getFrame(41)->setY(0);
+               _texture->getFrame(41)->setX(cell_x);
+               _texture->getFrame(41)->setY(cell_y);
                _texture->getFrame(41)->blit(this);
 
                https:// Draw facilities
@@ -121,8 +123,8 @@ void MiniBaseView::draw()
                                else
                                        color = _red;
 
-                               r.x = i * (MINI_SIZE + 2) + 2 + (*f)->getX() * 2;
-                               r.y = 2 + (*f)->getY() * 2;
+                               r.x = cell_x + 2 + (*f)->getX() * 2;
+                               r.y = cell_y + 2 + (*f)->getY() * 2;
                                r.w = (*f)->getRules()->getSize() * 2;
                                r.h = (*f)->getRules()->getSize() * 2;
                                drawRect(&r, color+3);
@@ -156,6 +158,7 @@ void MiniBaseView::draw()
 void MiniBaseView::mouseOver(Action *action, State *state)
 {
        _hoverBase = (int)floor(action->getRelativeXMouse() / ((MINI_SIZE + 2) * action->getXScale()));
+       _hoverBase += (int)floor(action->getRelativeYMouse() / ((MINI_SIZE + 2) * action->getYScale())) * ROW_BASES;
        InteractiveSurface::mouseOver(action, state);
 }
 
diff --git a/src/Basescape/MiniBaseView.h b/src/Basescape/MiniBaseView.h
index 9168634..0bef494 100644
--- a/src/Basescape/MiniBaseView.h
+++ b/src/Basescape/MiniBaseView.h
@@ -43,7 +43,8 @@ private:
        size_t _base, _hoverBase;
        Uint8 _red, _green;
 public:
-       static const size_t MAX_BASES = 8;
+       static const size_t MAX_BASES = 16;
+       static const size_t ROW_BASES = 8;
        https:/// Creates a new mini base view at the specified position and size.
        MiniBaseView(int width, int height, int x = 0, int y = 0);
        https:/// Cleans up the mini base view.



EDIT: yea, it doesn't show extra bases in Logs screen, I know

Pages: 1 [2]