~ubuntu-branches/ubuntu/trusty/rlvm/trusty

« back to all changes in this revision

Viewing changes to src/Modules/Module_ObjPosDims.cpp

  • Committer: Package Import Robot
  • Author(s): Ying-Chun Liu (PaulLiu)
  • Date: 2013-11-02 02:57:13 UTC
  • mfrom: (10.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20131102025713-yzg31grxr8i7xerh
Tags: 0.13-1
* New upstream release
  - rlvm will now warn on startup when it detects Japanese save data, but
    English patched game files, and offer to reset the save data.
  - Much better support for Little Busters. Most graphical glitches during
    the Little Busters Refrain have been fixed.
  - TCC tone curve effects have been reverse-engineered and implemented
    (thanks to lurkmoar)
  - Sepia scenes (and other graphical filters) should look much better.
  - Simple shake commands implemented (fancy per-layer shaking still
    unimplemented).
  - Make animations smooth: data should be uploaded to the graphics card
    before an animation loop starts, not while the animation loop is
    running.
  - Fixes finding system fonts on Linux
  - Thanks to Elliot Glaysher <glaysher@umich.edu>
* Remove upstreamed patches:
  - debian/patches/002_675426ad62bccf1de10b0ae31dd46331ec47aacb.patch
  - debian/patches/003_5dafabf5448635c4d4526d6e35ea7ec664a27261.patch
  - debian/patches/004_boost-drop-mt.patch
  - debian/patches/005_missing-include.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- Mode: C++; tab-width:2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2
 
// vi:tw=80:et:ts=2:sts=2
3
 
//
4
 
// -----------------------------------------------------------------------
5
 
//
6
 
// This file is part of RLVM, a RealLive virtual machine clone.
7
 
//
8
 
// -----------------------------------------------------------------------
9
 
//
10
 
// Copyright (C) 2006, 2007 Elliot Glaysher
11
 
//
12
 
// This program is free software; you can redistribute it and/or modify
13
 
// it under the terms of the GNU General Public License as published by
14
 
// the Free Software Foundation; either version 3 of the License, or
15
 
// (at your option) any later version.
16
 
//
17
 
// This program is distributed in the hope that it will be useful,
18
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 
// GNU General Public License for more details.
21
 
//
22
 
// You should have received a copy of the GNU General Public License
23
 
// along with this program; if not, write to the Free Software
24
 
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
25
 
//
26
 
// -----------------------------------------------------------------------
27
 
 
28
 
#include "Module_Obj.hpp"
29
 
#include "Module_ObjPosDims.hpp"
30
 
 
31
 
#include "MachineBase/Properties.hpp"
32
 
#include "MachineBase/RLOperation.hpp"
33
 
#include "MachineBase/RLOperation/DefaultValue.hpp"
34
 
#include "MachineBase/RLOperation/References.hpp"
35
 
#include "MachineBase/RLOperation/RLOp_Store.hpp"
36
 
 
37
 
#include "Systems/Base/GraphicsObject.hpp"
38
 
 
39
 
// -----------------------------------------------------------------------
40
 
 
41
 
namespace {
42
 
 
43
 
/**
44
 
 * Theoretically implements objGetPos. People don't actually
45
 
 * understand what's going on in this module (more so then anything
46
 
 * else in rldev/rlvm.)
47
 
 *
48
 
 * This is probably wrong or overlooks all sorts of weird corner cases
49
 
 * that aren't immediatly obvious.
50
 
 */
51
 
struct objGetPos
52
 
    : public RLOp_Void_3< IntConstant_T, IntReference_T, IntReference_T > {
53
 
  void operator()(RLMachine& machine, int objNum, IntReferenceIterator xIt,
54
 
                  IntReferenceIterator yIt) {
55
 
    GraphicsObject& obj = getGraphicsObject(machine, this, objNum);
56
 
    *xIt = obj.x();
57
 
    *yIt = obj.y();
58
 
  }
59
 
};
60
 
 
61
 
struct objGetPosX : public RLOp_Store_1< IntConstant_T> {
62
 
  int operator()(RLMachine& machine, int objNum) {
63
 
    GraphicsObject& obj = getGraphicsObject(machine, this, objNum);
64
 
    return obj.x();
65
 
  }
66
 
};
67
 
 
68
 
struct objGetPosY : public RLOp_Store_1< IntConstant_T> {
69
 
  int operator()(RLMachine& machine, int objNum) {
70
 
    GraphicsObject& obj = getGraphicsObject(machine, this, objNum);
71
 
    return obj.y();
72
 
  }
73
 
};
74
 
 
75
 
/**
76
 
 * @note objGetDims takes an integer as its fourth argument, but we
77
 
 * have no idea what this is or how it affects things. Usually appears
78
 
 * to be 4. ????
79
 
 */
80
 
struct objGetDims
81
 
  : public RLOp_Void_4< IntConstant_T, IntReference_T, IntReference_T,
82
 
                        DefaultIntValue_T<4> > {
83
 
  void operator()(RLMachine& machine, int objNum, IntReferenceIterator widthIt,
84
 
                  IntReferenceIterator heightIt, int unknown) {
85
 
    GraphicsObject& obj = getGraphicsObject(machine, this, objNum);
86
 
    *widthIt = obj.pixelWidth();
87
 
    *heightIt = obj.pixelHeight();
88
 
  }
89
 
};
90
 
 
91
 
void addFunctions(RLModule& m) {
92
 
  m.addOpcode(1000, 0, "objGetPos", new objGetPos);
93
 
  m.addOpcode(1001, 0, "objGetPosX", new objGetPosX);
94
 
  m.addOpcode(1002, 0, "objGetPosY", new objGetPosY);
95
 
  m.addOpcode(1100, 0, "objGetDims", new objGetDims);
96
 
  m.addOpcode(1100, 1, "objGetDims", new objGetDims);
97
 
}
98
 
 
99
 
}  // namespace
100
 
 
101
 
// -----------------------------------------------------------------------
102
 
 
103
 
ObjFgPosDimsModule::ObjFgPosDimsModule()
104
 
    : RLModule("ObjFgPosDims", 1, 84) {
105
 
  addFunctions(*this);
106
 
  setProperty(P_FGBG, OBJ_FG);
107
 
}
108
 
 
109
 
// -----------------------------------------------------------------------
110
 
 
111
 
ObjBgPosDimsModule::ObjBgPosDimsModule()
112
 
    : RLModule("ObjBgPosDims", 1, 85) {
113
 
  addFunctions(*this);
114
 
  setProperty(P_FGBG, OBJ_BG);
115
 
}
116
 
 
117
 
// -----------------------------------------------------------------------
118
 
 
119
 
ChildObjFgPosDimsModule::ChildObjFgPosDimsModule()
120
 
    : MappedRLModule(childObjMappingFun, "ChildObjFgPosDims", 2, 84) {
121
 
  addFunctions(*this);
122
 
  setProperty(P_FGBG, OBJ_FG);
123
 
}
124
 
 
125
 
// -----------------------------------------------------------------------
126
 
 
127
 
ChildObjBgPosDimsModule::ChildObjBgPosDimsModule()
128
 
    : MappedRLModule(childObjMappingFun, "ChildObjBgPosDims", 2, 85) {
129
 
  addFunctions(*this);
130
 
  setProperty(P_FGBG, OBJ_BG);
131
 
}