[Scummvm-git-logs] scummvm master -> 5c2f3f056961037ea3200eadf36daae58a982c2b

dreammaster paulfgilbert at gmail.com
Thu Feb 20 05:38:15 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
5c2f3f0569 ULTIMA8: Remove the joystick cursor process


Commit: 5c2f3f056961037ea3200eadf36daae58a982c2b
    https://github.com/scummvm/scummvm/commit/5c2f3f056961037ea3200eadf36daae58a982c2b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-19T21:35:36-08:00

Commit Message:
ULTIMA8: Remove the joystick cursor process

Changed paths:
  R engines/ultima/ultima8/kernel/joystick.cpp
  R engines/ultima/ultima8/kernel/joystick.h
    engines/ultima/module.mk
    engines/ultima/ultima8/kernel/hid_manager.cpp
    engines/ultima/ultima8/kernel/hid_manager.h
    engines/ultima/ultima8/ultima8.cpp


diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 37e0cac..8b3e1cc 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -437,7 +437,6 @@ MODULE_OBJS := \
 	ultima8/kernel/delay_process.o \
 	ultima8/kernel/hid_keys.o \
 	ultima8/kernel/hid_manager.o \
-	ultima8/kernel/joystick.o \
 	ultima8/kernel/kernel.o \
 	ultima8/kernel/memory_manager.o \
 	ultima8/kernel/mouse.o \
diff --git a/engines/ultima/ultima8/kernel/hid_manager.cpp b/engines/ultima/ultima8/kernel/hid_manager.cpp
index 0514449..794a7ca 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.cpp
+++ b/engines/ultima/ultima8/kernel/hid_manager.cpp
@@ -36,7 +36,6 @@ HIDManager::HIDManager() {
 	_hidManager = this;
 	con->Print(MM_INFO, "Creating HIDManager...\n");
 
-	InitJoystick();
 	resetBindings();
 }
 
@@ -51,7 +50,6 @@ HIDManager::~HIDManager() {
 	}
 	_commands.clear();
 
-	ShutdownJoystick();
 	_hidManager = 0;
 }
 
diff --git a/engines/ultima/ultima8/kernel/hid_manager.h b/engines/ultima/ultima8/kernel/hid_manager.h
index 112e7b7..95765a9 100644
--- a/engines/ultima/ultima8/kernel/hid_manager.h
+++ b/engines/ultima/ultima8/kernel/hid_manager.h
@@ -25,7 +25,6 @@
 
 #include "ultima/shared/std/containers.h"
 #include "ultima/ultima8/kernel/hid_keys.h"
-#include "ultima/ultima8/kernel/joystick.h"
 
 namespace Ultima {
 namespace Ultima8 {
diff --git a/engines/ultima/ultima8/kernel/joystick.cpp b/engines/ultima/ultima8/kernel/joystick.cpp
deleted file mode 100644
index 98758ef..0000000
--- a/engines/ultima/ultima8/kernel/joystick.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/kernel/joystick.h"
-#include "ultima/ultima8/ultima8.h"
-#include "ultima/shared/std/string.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-//static SDL_Joystick *joy[JOY_LAST] = {0};
-
-void InitJoystick() {
-#ifdef TODO
-	int i, buttons, axes, balls, hats;
-	int joys = SDL_NumJoysticks();
-
-	for (i = 0; i < joys; ++i) {
-		if (i >= JOY_LAST) {
-			perr << "Additional joysticks detected. Cannot initialize more than "
-			     << JOY_LAST << "." << Std::endl;
-			break;
-		}
-
-		joy[i] = 0;
-
-		if (! SDL_JoystickOpened(i)) {
-			joy[i] = SDL_JoystickOpen(i);
-			if (joy[i]) {
-				buttons = SDL_JoystickNumButtons(joy[i]);
-				axes = SDL_JoystickNumAxes(joy[i]);
-				balls = SDL_JoystickNumBalls(joy[i]);
-				hats = SDL_JoystickNumHats(joy[i]);
-
-				pout << "Initialized joystick " << i + 1 << "." << Std::endl;
-				pout << "\tButtons: " << buttons << Std::endl;
-				pout << "\tAxes: " << axes << Std::endl;
-				pout << "\tBalls: " << balls << Std::endl;
-				pout << "\tHats: " << hats << Std::endl;
-			} else {
-				perr << "Error while initializing joystick " << i + 1 << "."
-				     << Std::endl;
-			}
-		}
-	}
-#endif
-}
-
-void ShutdownJoystick() {
-#ifdef TODO
-	int i;
-	for (i = 0; i < JOY_LAST; ++i) {
-		if (joy[i] && SDL_JoystickOpened(i)) {
-			SDL_JoystickClose(joy[i]);
-		}
-		joy[i] = 0;
-	}
-#endif
-}
-
-DEFINE_RUNTIME_CLASSTYPE_CODE(JoystickCursorProcess, Process)
-
-JoystickCursorProcess::JoystickCursorProcess()
-	: Process(), _js(JOY1), _xAxis(0), _yAxis(1), _ticks(0), _accel(0) {
-}
-
-JoystickCursorProcess::JoystickCursorProcess(Joystick js_, int x_axis_, int y_axis_)
-	: Process(), _js(js_), _xAxis(x_axis_), _yAxis(y_axis_), _ticks(0), _accel(0) {
-#ifdef TODO
-	flags |= PROC_RUNPAUSED;
-	type = 1;
-
-	if (joy[_js] && _js < JOY_LAST) {
-		int axes = SDL_JoystickNumAxes(joy[_js]);
-		if (_xAxis >= axes && _yAxis >= axes) {
-			perr << "Failed to start JoystickCursorProcess: illegal axis for x (" << _xAxis << ") or y (" << _yAxis << ")" << Std::endl;
-			terminate();
-		}
-	} else {
-		terminate();
-	}
-#endif
-}
-
-JoystickCursorProcess::~JoystickCursorProcess() {
-}
-
-#define AXIS_TOLERANCE 1000
-
-//! CONSTANTS - and a lot of guess work
-void JoystickCursorProcess::run() {
-#ifdef TODO
-	int dx = 0, dy = 0;
-	int now = g_system->getMillis();
-
-	if (joy[_js] && _ticks) {
-		int tx = now - _ticks;
-		int r = 350 - _accel * 30;
-		int16 jx = SDL_JoystickGetAxis(joy[_js], _xAxis);
-		int16 jy = SDL_JoystickGetAxis(joy[_js], _yAxis);
-		if (jx > AXIS_TOLERANCE || jx < -AXIS_TOLERANCE)
-			dx = ((jx / 1000) * tx) / r;
-		if (jy > AXIS_TOLERANCE || jy < -AXIS_TOLERANCE)
-			dy = ((jy / 1000) * tx) / r;
-	}
-
-	_ticks = now;
-
-	if (dx || dy) {
-		int mx, my;
-		Ultima8Engine *app = Ultima8Engine::get_instance();
-		app->getMouseCoords(mx, my);
-		mx += dx;
-		my += dy;
-		app->setMouseCoords(mx, my);
-		++_accel;
-		if (_accel > 10)
-			_accel = 10;
-	} else {
-		_accel = 0;
-	}
-#endif
-}
-
-bool JoystickCursorProcess::loadData(IDataSource *ids, uint32 version) {
-	if (!Process::loadData(ids, version)) return false;
-
-	terminateDeferred(); // Don't allow this process to continue
-	return true;
-}
-
-void JoystickCursorProcess::saveData(ODataSource *ods) {
-	Process::saveData(ods);
-	// saves no status
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/kernel/joystick.h b/engines/ultima/ultima8/kernel/joystick.h
deleted file mode 100644
index 492cb48..0000000
--- a/engines/ultima/ultima8/kernel/joystick.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_KERNEL_JOYSTICK_H
-#define ULTIMA8_KERNEL_JOYSTICK_H
-
-#include "ultima/ultima8/kernel/process.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-/*
-   For now, we are limiting to one joystick, 16 buttons,
-   and we are ignoring anything other than buttons and axes (hats and balls)
-*/
-
-enum Joystick {
-	JOY1 = 0,
-	JOY_LAST
-};
-
-void InitJoystick();
-void ShutdownJoystick();
-
-class JoystickCursorProcess : public Process {
-public:
-	JoystickCursorProcess();
-	JoystickCursorProcess(Joystick js_, int x_axis_, int y_axis_);
-	~JoystickCursorProcess() override;
-
-	ENABLE_RUNTIME_CLASSTYPE()
-
-	void run() override;
-
-	bool loadData(IDataSource *ids, uint32 version);
-protected:
-	void saveData(ODataSource *ods) override;
-
-	Joystick _js;
-	int _xAxis, _yAxis;
-	int _ticks;
-	int _accel;
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index f897a97..a701acd 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -27,12 +27,11 @@
 #include "common/config-manager.h"
 #include "gui/saveload.h"
 #include "image/png.h"
-
 #include "ultima/shared/engine/events.h"
 #include "ultima/ultima8/ultima8.h"
 #include "ultima/ultima8/misc/pent_include.h"
 
- //!! a lot of these includes are just for some hacks... clean up sometime
+ // TODO: !! a lot of these includes are just for some hacks... clean up sometime
 #include "ultima/ultima8/kernel/kernel.h"
 #include "ultima/ultima8/filesys/file_system.h"
 #include "ultima/ultima8/conf/setting_manager.h"
@@ -42,8 +41,6 @@
 #include "ultima/ultima8/graphics/fonts/font_manager.h"
 #include "ultima/ultima8/kernel/memory_manager.h"
 #include "ultima/ultima8/kernel/hid_manager.h"
-#include "ultima/ultima8/kernel/joystick.h"
-
 #include "ultima/ultima8/graphics/render_surface.h"
 #include "ultima/ultima8/graphics/texture.h"
 #include "ultima/ultima8/graphics/fonts/fixed_width_font.h"
@@ -56,7 +53,6 @@
 #include "ultima/ultima8/games/game.h"
 #include "ultima/ultima8/world/get_object.h"
 #include "ultima/ultima8/filesys/savegame.h"
-
 #include "ultima/ultima8/gumps/gump.h"
 #include "ultima/ultima8/gumps/desktop_gump.h"
 #include "ultima/ultima8/gumps/console_gump.h"
@@ -74,8 +70,6 @@
 #include "ultima/ultima8/gumps/ask_gump.h"
 #include "ultima/ultima8/gumps/modal_gump.h"
 #include "ultima/ultima8/gumps/message_box_gump.h"
-
-
 #include "ultima/ultima8/world/actors/quick_avatar_mover_process.h"
 #include "ultima/ultima8/world/actors/actor.h"
 #include "ultima/ultima8/world/actors/actor_anim_process.h"
@@ -87,7 +81,6 @@
 #include "ultima/ultima8/graphics/inverter_process.h"
 #include "ultima/ultima8/world/actors/heal_process.h"
 #include "ultima/ultima8/world/actors/scheduler_process.h"
-
 #include "ultima/ultima8/world/egg_hatcher_process.h" // for a hack
 #include "ultima/ultima8/usecode/uc_process.h" // more hacking
 #include "ultima/ultima8/gumps/gump_notify_process.h" // guess
@@ -408,8 +401,6 @@ void Ultima8Engine::startup() {
 		ProcessLoader<InverterProcess>::load);
 	_kernel->addProcessLoader("ActorBarkNotifyProcess",
 		ProcessLoader<ActorBarkNotifyProcess>::load);
-	_kernel->addProcessLoader("JoystickCursorProcess",
-		ProcessLoader<JoystickCursorProcess>::load);
 	_kernel->addProcessLoader("AmbushProcess",
 		ProcessLoader<AmbushProcess>::load);
 
@@ -418,10 +409,6 @@ void Ultima8Engine::startup() {
 
 	GraphicSysInit();
 
-#ifdef TODO
-	SDL_ShowCursor(SDL_DISABLE);
-	SDL_GetMouseState(&mouseX, &mouseY);
-#endif
 	_hidManager = new HIDManager();
 
 	// Audio Mixer




More information about the Scummvm-git-logs mailing list