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

« back to all changes in this revision

Viewing changes to src/Systems/Base/GraphicsObjectOfFile.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:
89
89
// -----------------------------------------------------------------------
90
90
 
91
91
void GraphicsObjectOfFile::loadFile() {
92
 
  surface_ = system_.graphics().loadNonCGSurfaceFromFile(filename_);
 
92
  surface_ = system_.graphics().getSurfaceNamed(filename_);
 
93
  surface_->EnsureUploaded();
93
94
}
94
95
 
95
96
// -----------------------------------------------------------------------
97
98
int GraphicsObjectOfFile::pixelWidth(const GraphicsObject& rp) {
98
99
  const Surface::GrpRect& rect = surface_->getPattern(rp.pattNo());
99
100
  int width = rect.rect.width();
100
 
  return int((rp.width() / 100.0f) * width);
 
101
  return int(rp.getWidthScaleFactor() * width);
101
102
}
102
103
 
103
104
// -----------------------------------------------------------------------
105
106
int GraphicsObjectOfFile::pixelHeight(const GraphicsObject& rp) {
106
107
  const Surface::GrpRect& rect = surface_->getPattern(rp.pattNo());
107
108
  int height = rect.rect.height();
108
 
  return int((rp.height() / 100.0f) * height);
 
109
  return int(rp.getHeightScaleFactor() * height);
109
110
}
110
111
 
111
112
// -----------------------------------------------------------------------
116
117
 
117
118
// -----------------------------------------------------------------------
118
119
 
119
 
void GraphicsObjectOfFile::execute() {
 
120
void GraphicsObjectOfFile::execute(RLMachine& machine) {
120
121
  if (currentlyPlaying()) {
121
122
    unsigned int current_time = system_.event().getTicks();
122
123
    unsigned int time_since_last_frame_change =
150
151
 
151
152
// -----------------------------------------------------------------------
152
153
 
153
 
boost::shared_ptr<Surface> GraphicsObjectOfFile::currentSurface(
 
154
boost::shared_ptr<const Surface> GraphicsObjectOfFile::currentSurface(
154
155
  const GraphicsObject& rp) {
155
156
  return surface_;
156
157
}
158
159
// -----------------------------------------------------------------------
159
160
 
160
161
Rect GraphicsObjectOfFile::srcRect(const GraphicsObject& go) {
161
 
  if (currentlyPlaying())
 
162
  if (time_at_last_frame_change_ != 0) {
 
163
    // If we've ever been treated as an animation, we need to continue acting
 
164
    // as an animation even if we've stopped.
162
165
    return surface_->getPattern(current_frame_).rect;
 
166
  }
163
167
 
164
168
  return GraphicsObjectData::srcRect(go);
165
169
}
196
200
    & filename_ & frame_time_ & current_frame_ & time_at_last_frame_change_;
197
201
 
198
202
  loadFile();
 
203
 
 
204
  // Saving |time_at_last_frame_change_| as part of the format is obviously a
 
205
  // mistake, but is now baked into the file format. Ask the clock for a more
 
206
  // suitable value.
 
207
  if (time_at_last_frame_change_ != 0) {
 
208
    time_at_last_frame_change_ = system_.event().getTicks();
 
209
    system_.graphics().markScreenAsDirty(GUT_DISPLAY_OBJ);
 
210
  }
199
211
}
200
212
 
201
213
// -----------------------------------------------------------------------