From d5b4262bc0c6cea41c603e8a3a85ab93adfdc36b Mon Sep 17 00:00:00 2001 From: Charles McGarvey Date: Sun, 1 Nov 2009 13:51:49 -0700 Subject: [PATCH] random changes --- COPYING | 2 +- extra/yoink.ebuild | 4 ++-- make-win32-installer.sh.in | 4 ++-- src/Character.cc | 17 ++++------------- src/Character.hh | 16 +++------------- src/Moof/RK4.hh | 25 +++++++++++++++++++++---- src/Typesetter.cc | 1 + 7 files changed, 34 insertions(+), 35 deletions(-) diff --git a/COPYING b/COPYING index 8138ee3..293eda0 100644 --- a/COPYING +++ b/COPYING @@ -53,7 +53,7 @@ Copyright: © 2000-2004, Unicode, Inc. Portion: original image and sound resources Source: http://www.nether.org.uk/bad_mac_code.html -Copyright: Neil Carter +Copyright: © 2003, Neil Carter License: zlib-libpng Portion: cml diff --git a/extra/yoink.ebuild b/extra/yoink.ebuild index 1b3b1ba..bad9149 100644 --- a/extra/yoink.ebuild +++ b/extra/yoink.ebuild @@ -7,11 +7,11 @@ EAPI=2 inherit autotools eutils games DESCRIPTION="Alien-smashing action game" -HOMEPAGE="http://www.dogcows.com/" +HOMEPAGE="http://www.dogcows.com/yoink/" SRC_URI="http://www.dogcows.com/yoink/${P}.tar.bz2 http://eng.utah.edu/~mcgarvey/yoink/${P}.tar.bz2" -LICENSE="BSD-2" +LICENSE="BSD-2 BSD LGPL-2.1 ZLIB" SLOT="0" KEYWORDS="amd64 ~ppc x86" IUSE="debug profile" diff --git a/make-win32-installer.sh.in b/make-win32-installer.sh.in index 6cf54b1..4bfc6b3 100644 --- a/make-win32-installer.sh.in +++ b/make-win32-installer.sh.in @@ -88,8 +88,8 @@ RequestExecutionLevel highest ;; Modern UI Configuration ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -!define MUI_ICON "$ROOT_DIR/src/yoink.ico" -!define MUI_UNICON "$ROOT_DIR/src/yoink.ico" +!define MUI_ICON "$ROOT_DIR/src/yoink_setup.ico" +!define MUI_UNICON "$ROOT_DIR/src/yoink_uninstall.ico" ; Language !define MUI_LANGDLL_ALWAYSSHOW !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" diff --git a/src/Character.cc b/src/Character.cc index 8e5a4c6..accad65 100644 --- a/src/Character.cc +++ b/src/Character.cc @@ -48,8 +48,6 @@ Character::Character(const std::string& name) : current.recalculate(); previous = current; - - //updateContainers(); } @@ -61,28 +59,21 @@ void Character::update(Mf::Scalar t, Mf::Scalar dt) Mf::Scalar mag = x.length(); Mf::Scalar d = 50.0; + // gravity: current.force = Mf::Vector2(0.0, -2000.0); + // spring: //current.force += -15.0 * x - 1.5 * current.velocity; current.force += -20.0 * (mag - d) * (x / mag) - 2.0 * current.velocity; + // internal: current.force += userForce; current.recalculate(); //std::cout << "force: " << current.momentum << std::endl; - Mf::integrate(current, t, dt); + Mf::euler(current, t, dt); animation_.update(t, dt); - - //updateContainers(); } -//void Character::updateContainers() -//{ - //aabb_.init(Mf::Vector3(current.position[0]-16.0, current.position[1]-16.0, z), - //Mf::Vector3(current.position[0]+16.0, current.position[1]+16.0, z)); - //sphere_.point = Mf::Vector3(current.position[0], current.position[1], z); - //sphere_.radius = (aabb_.min - sphere_.point).length(); -//} - void Character::draw(Mf::Scalar alpha) const { diff --git a/src/Character.hh b/src/Character.hh index c19206c..087bf49 100644 --- a/src/Character.hh +++ b/src/Character.hh @@ -101,6 +101,9 @@ struct Character : public Mf::Entity //derivative.force = Mf::Vector2(0.0, 0.0); derivative.velocity = velocity; derivative.force = force; + + //Mf::Vector2 x = position - Mf::Vector2(500.0, 200.0); + //derivative.force += -15.0 * x - 1.5 * velocity; } void applyDerivative(const Derivative& derivative, Mf::Scalar dt) @@ -143,8 +146,6 @@ private: Mf::Tilemap tilemap_; Mf::Animation animation_; - //void updateContainers(); - protected: Mf::Vector2 userForce; @@ -162,17 +163,6 @@ public: }; -//inline Character::State operator*(Mf::Scalar scalar, - //const Character::State& state) -//{ - //Character::State newState = state; - //newState.position *= scalar; - //newState.momentum *= scalar; - //newState.recalculate(); - //return newState; -//} - - #endif // _CHARACTER_HH_ /** vim: set ts=4 sw=4 tw=80: *************************************************/ diff --git a/src/Moof/RK4.hh b/src/Moof/RK4.hh index a2e0f1c..806127e 100644 --- a/src/Moof/RK4.hh +++ b/src/Moof/RK4.hh @@ -34,9 +34,9 @@ namespace Mf { -// Generic implementation of the RK4 integrator. To use, you need one type -// representing the state and another containing the derivatives of the primary -// state variables. The state class must implement these methods: +// Generic implementations of a few simple integrators. To use, you need one +// type representing the state and another containing the derivatives of the +// primary state variables. The state class must implement these methods: // // void getDerivative(Derivative_Type& derivative, Scalar absoluteTime); // void applyDerivative(const Derivative_Type& derivative, Scalar deltaTime); @@ -64,7 +64,24 @@ inline D evaluate(const S& state, Scalar t, Scalar dt, const D& derivative) template -inline void integrate(S& state, Scalar t, Scalar dt) +inline void euler(S& state, Scalar t, Scalar dt) +{ + D a = evaluate(state, t); + + state.applyDerivative(a, dt); +} + +template +inline void rk2(S& state, Scalar t, Scalar dt) +{ + D a = evaluate(state, t); + D b = evaluate(state, t, dt * 0.5, a); + + state.applyDerivative(b, dt); +} + +template +inline void rk4(S& state, Scalar t, Scalar dt) { D a = evaluate(state, t); D b = evaluate(state, t, dt * 0.5, a); diff --git a/src/Typesetter.cc b/src/Typesetter.cc index bd8d4ea..2692919 100644 --- a/src/Typesetter.cc +++ b/src/Typesetter.cc @@ -47,5 +47,6 @@ void Typesetter::print(const std::string& format, ...) nPrinted = std::min(nPrinted, (int)sizeof(buffer) - 1); } + /** vim: set ts=4 sw=4 tw=80: *************************************************/ -- 2.43.0