Mercurial > otakunoraifu
comparison scn2k/scn2k_grp.cc @ 65:4416cfac86ae
Convert EUC-JP files to UTF8
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Fri, 26 Nov 2010 10:53:15 +0100 |
parents | e16e13d8cd68 |
children | 1fd20d231376 |
comparison
equal
deleted
inserted
replaced
64:045ca45f9610 | 65:4416cfac86ae |
---|---|
124 if (src_pos.empty()) { | 124 if (src_pos.empty()) { |
125 width = 0; height = 0; | 125 width = 0; height = 0; |
126 if (name.length() == 0) { | 126 if (name.length() == 0) { |
127 return; | 127 return; |
128 } | 128 } |
129 /* ボタンの位置情報を求める */ | 129 /* 帥潟篏臀宴羆 */ |
130 /* g00 ファイルのヘッダ部分に位置情報は入っている */ | 130 /* g00 <ゃ篏臀宴ャc */ |
131 string path(name); | 131 string path(name); |
132 path += ".g00"; | 132 path += ".g00"; |
133 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, path.c_str(), "g00"); | 133 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, path.c_str(), "g00"); |
134 if (info == NULL) { // ファイルが見つからない | 134 if (info == NULL) { // <ゃ荀ゃ |
135 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); | 135 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); |
136 return; | 136 return; |
137 } | 137 } |
138 const char* data = info->Read(); | 138 const char* data = info->Read(); |
139 if (data != NULL && *data == 2) { // 画像ファイル内にボタン情報が存在する | 139 if (data != NULL && *data == 2) { // 糸<ゃ帥恰宴絖 |
140 int srclen = read_little_endian_int(data+5); | 140 int srclen = read_little_endian_int(data+5); |
141 int i; | 141 int i; |
142 for (i=0; i<srclen; i++) { | 142 for (i=0; i<srclen; i++) { |
143 int x1 = read_little_endian_int(data+9+i*24+0); | 143 int x1 = read_little_endian_int(data+9+i*24+0); |
144 int y1 = read_little_endian_int(data+9+i*24+4); | 144 int y1 = read_little_endian_int(data+9+i*24+4); |
146 int y2 = read_little_endian_int(data+9+i*24+12); | 146 int y2 = read_little_endian_int(data+9+i*24+12); |
147 src_pos.push_back(Rect(x1, y1, x2+1, y2+1)); | 147 src_pos.push_back(Rect(x1, y1, x2+1, y2+1)); |
148 if (width < src_pos.back().width()) width = src_pos.back().width(); | 148 if (width < src_pos.back().width()) width = src_pos.back().width(); |
149 if (height < src_pos.back().height()) height = src_pos.back().height(); | 149 if (height < src_pos.back().height()) height = src_pos.back().height(); |
150 } | 150 } |
151 } else { // 画像ファイルから大きさ取得 | 151 } else { // 糸<ゃ紊с緇 |
152 width = read_little_endian_short(data+1); | 152 width = read_little_endian_short(data+1); |
153 height = read_little_endian_short(data+3); | 153 height = read_little_endian_short(data+3); |
154 src_pos.push_back(Rect(0,0,width,height)); | 154 src_pos.push_back(Rect(0,0,width,height)); |
155 } | 155 } |
156 delete info; | 156 delete info; |
211 if (picture != NULL) { | 211 if (picture != NULL) { |
212 PicBase* p = DeletePic(); | 212 PicBase* p = DeletePic(); |
213 delete p; | 213 delete p; |
214 } | 214 } |
215 src_pos.clear(); | 215 src_pos.clear(); |
216 // picture を作成 | 216 // picture 篏 |
217 pic_parent = parent; | 217 pic_parent = parent; |
218 picture = parent->create_leaf(Rect(_posx,_posy,_posx+1,_posy+1), 0); | 218 picture = parent->create_leaf(Rect(_posx,_posy,_posx+1,_posy+1), 0); |
219 picture->hide(); | 219 picture->hide(); |
220 UpdateSurface(); | 220 UpdateSurface(); |
221 } | 221 } |
223 void GrpObj::UpdateSurface(void) { | 223 void GrpObj::UpdateSurface(void) { |
224 if (pic_parent == NULL || picture == NULL) return; | 224 if (pic_parent == NULL || picture == NULL) return; |
225 int width = 0, height = 0; | 225 int width = 0, height = 0; |
226 if (gtype == FILE || gtype == GAN) { | 226 if (gtype == FILE || gtype == GAN) { |
227 if (name.length() == 0) return; | 227 if (name.length() == 0) return; |
228 // ファイル名が存在する場合、ファイルを読み込み | 228 // <ゃ絖翫<ゃ茯粋昭 |
229 GetSrcGeom(width, height); | 229 GetSrcGeom(width, height); |
230 if (width <= 0 || height <= 0) return; | 230 if (width <= 0 || height <= 0) return; |
231 // surface の設定 | 231 // surface 荐絎 |
232 if (surface_num == 0 && ( (zoom > 0 && zoom != 256) || rotate > 0)) { | 232 if (surface_num == 0 && ( (zoom > 0 && zoom != 256) || rotate > 0)) { |
233 ZoomRotate(); | 233 ZoomRotate(); |
234 } else { | 234 } else { |
235 // 普通に surface を設定 | 235 // surface 荐絎 |
236 string path(name); | 236 string path(name); |
237 path += ".g00"; | 237 path += ".g00"; |
238 picture->SetSurface(path.c_str(), 0, 0); | 238 picture->SetSurface(path.c_str(), 0, 0); |
239 picture->SetSurfaceRect(Rect(0,0,width,height)); | 239 picture->SetSurfaceRect(Rect(0,0,width,height)); |
240 } | 240 } |
241 if (attr & BLIT_ADD) | 241 if (attr & BLIT_ADD) |
242 picture->SetSurfaceAttribute(PicBase::BLIT_ADD); | 242 picture->SetSurfaceAttribute(PicBase::BLIT_ADD); |
243 } else if (gtype == MOJI) { // テキスト描画 | 243 } else if (gtype == MOJI) { // 鴻 |
244 if (print_moji.length() == 0) return; | 244 if (print_moji.length() == 0) return; |
245 UpdateMoji(); | 245 UpdateMoji(); |
246 } else if (gtype == DIGIT) { // 数値を画像表示 | 246 } else if (gtype == DIGIT) { // 医ゃ糸頫腓 |
247 UpdateDigit(); | 247 UpdateDigit(); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 void GrpObj::ZoomRotate(void) { | 251 void GrpObj::ZoomRotate(void) { |
252 picture->SetSurface( (Surface*)0, 0, 0); | 252 picture->SetSurface( (Surface*)0, 0, 0); |
253 | 253 |
254 // 回転、縮小拡大は座標原点が画像の中心になる | 254 // 荵≪膰絨≦ぇ綺ф鴻糸筝綽 |
255 string path(name); | 255 string path(name); |
256 path += ".g00"; | 256 path += ".g00"; |
257 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | 257 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); |
258 if (surface_orig == NULL) return; | 258 if (surface_orig == NULL) return; |
259 | 259 |
260 Surface* zoom_surface = pic_parent->Root().RotZoomSurface(surface_orig, double(zoom)/256.0, rotate); | 260 Surface* zoom_surface = pic_parent->Root().RotZoomSurface(surface_orig, double(zoom)/256.0, rotate); |
261 Rect zoom_r (*zoom_surface); | 261 Rect zoom_r (*zoom_surface); |
262 picture->SetSurface(zoom_surface, 0, 0); | 262 picture->SetSurface(zoom_surface, 0, 0); |
263 picture->SetSurfaceFreeFlag(); | 263 picture->SetSurfaceFreeFlag(); |
264 //picture->Move(PosX() + - zoom_r.width()/2, PosY() + - zoom_r.height()/2); | 264 //picture->Move(PosX() + - zoom_r.width()/2, PosY() + - zoom_r.height()/2); |
265 // 中心座標がわからん・・・ | 265 // 筝綽綺ф祉祉 |
266 picture->Move(320 - zoom_r.width()/2, 240 - zoom_r.height()/2); | 266 picture->Move(320 - zoom_r.width()/2, 240 - zoom_r.height()/2); |
267 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); | 267 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); |
268 | 268 |
269 pic_parent->Root().DeleteSurface(surface_orig); | 269 pic_parent->Root().DeleteSurface(surface_orig); |
270 } | 270 } |
271 | 271 |
272 void GrpObj::UpdateMoji(void) { // 文字の大きさ、色などを変更 | 272 void GrpObj::UpdateMoji(void) { // 絖紊с蚊紊 |
273 if (print_moji.length() == 0 || print_size <= 2) return; | 273 if (print_moji.length() == 0 || print_size <= 2) return; |
274 if (pic_parent == 0) return; | 274 if (pic_parent == 0) return; |
275 /* テキストの大きさを得る */ | 275 /* 鴻紊с緇 */ |
276 int r, g, b; | 276 int r, g, b; |
277 if (print_r == -1 || print_g == -1 || print_b == -1) {// 色設定なし | 277 if (print_r == -1 || print_g == -1 || print_b == -1) {// 画┃絎 |
278 r = g = b = 0; // とりあえず黒(clannad のSave/Loadメニュー用) | 278 r = g = b = 0; // 藥(clannad Save/Load<ャ主) |
279 } else { | 279 } else { |
280 r = print_r; | 280 r = print_r; |
281 g = print_g; | 281 g = print_g; |
282 b = print_b; | 282 b = print_b; |
283 } | 283 } |
284 TextStream ts = TextStream::ParseMoji(print_moji.c_str(), r, g, b, print_size); | 284 TextStream ts = TextStream::ParseMoji(print_moji.c_str(), r, g, b, print_size); |
285 TextGlyphStream gs; | 285 TextGlyphStream gs; |
286 vector<int> lh; | 286 vector<int> lh; |
287 // とりあえず drawable width は充分に大きく(2048)取る | 287 // drawable width 紊с(2048) |
288 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2 | 288 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size 障障綣怨慌紊с -2 |
289 int width = gs.width(); | 289 int width = gs.width(); |
290 int height = gs.height(); | 290 int height = gs.height(); |
291 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK); | 291 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK); |
292 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | 292 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); |
293 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0)); | 293 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0)); |
295 picture->SetSurfaceRect(Rect(0,0,width,height)); | 295 picture->SetSurfaceRect(Rect(0,0,width,height)); |
296 picture->SetSurfaceFreeFlag(); | 296 picture->SetSurfaceFreeFlag(); |
297 } | 297 } |
298 | 298 |
299 void GrpObj::UpdateDigit(void) { | 299 void GrpObj::UpdateDigit(void) { |
300 // 画像表示の数値文字列を表示する | 300 // 糸頫腓冴医ゆ絖茵腓冴 |
301 if (name.length() == 0) return; | 301 if (name.length() == 0) return; |
302 // ファイル名が存在する場合、ファイルを読み込み | 302 // <ゃ絖翫<ゃ茯粋昭 |
303 string path(name); | 303 string path(name); |
304 path += ".g00"; | 304 path += ".g00"; |
305 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | 305 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); |
306 if (surface_orig == NULL) return; | 306 if (surface_orig == NULL) return; |
307 | 307 |
308 int width, height; | 308 int width, height; |
309 int i; | 309 int i; |
310 GetSrcGeom(width, height); | 310 GetSrcGeom(width, height); |
311 if (width <= 0 || height <= 0) return; | 311 if (width <= 0 || height <= 0) return; |
312 if (src_pos.size() < 14) { | 312 if (src_pos.size() < 14) { |
313 // 必要な数の object がない | 313 // 綽荀違 object |
314 // 表示できない分の空の rect を追加しておく | 314 // 茵腓冴с腥冴 rect 菴遵 |
315 for (i=src_pos.size(); i<14; i++) | 315 for (i=src_pos.size(); i<14; i++) |
316 src_pos.push_back(Rect(0,0,0,0)); | 316 src_pos.push_back(Rect(0,0,0,0)); |
317 pic_parent->Root().DeleteSurface(surface_orig); | 317 pic_parent->Root().DeleteSurface(surface_orig); |
318 return; | 318 return; |
319 } | 319 } |
320 // 桁数の計算 | 320 // 罅違荐膊 |
321 char num_str[20]; | 321 char num_str[20]; |
322 if (dig_number < 0) sprintf(num_str, "%d", -dig_number); | 322 if (dig_number < 0) sprintf(num_str, "%d", -dig_number); |
323 else sprintf(num_str, "%d", dig_number); | 323 else sprintf(num_str, "%d", dig_number); |
324 int sign_count = 0; | 324 int sign_count = 0; |
325 int space_count = 0; | 325 int space_count = 0; |
331 total_count = dig_count + space_count + sign_count; | 331 total_count = dig_count + space_count + sign_count; |
332 | 332 |
333 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK); | 333 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK); |
334 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | 334 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); |
335 | 335 |
336 /* surface にコピーする */ | 336 /* surface 潟若 */ |
337 int cur_x = 0; | 337 int cur_x = 0; |
338 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // 始めに空白を挿入 | 338 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // 紮腥榊純水 |
339 cur_x += space_count * width; | 339 cur_x += space_count * width; |
340 } | 340 } |
341 int plus = 10, minus = 11, plusminus = 12; | 341 int plus = 10, minus = 11, plusminus = 12; |
342 if (dig_number < 0) { | 342 if (dig_number < 0) { |
343 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0)); | 343 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0)); |
347 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0)); | 347 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0)); |
348 else | 348 else |
349 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0)); | 349 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0)); |
350 cur_x += width; | 350 cur_x += width; |
351 } | 351 } |
352 if (attr & DIG_ZERO) { // ゼロ・パディング | 352 if (attr & DIG_ZERO) { // 若祉c潟 |
353 for (i=0; i<space_count; i++) { | 353 for (i=0; i<space_count; i++) { |
354 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0)); | 354 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0)); |
355 cur_x += width;; | 355 cur_x += width;; |
356 } | 356 } |
357 } else if (!(attr & DIG_PACK)) { // PACK オプションなし | 357 } else if (!(attr & DIG_PACK)) { // PACK 激с潟 |
358 cur_x += space_count * width; | 358 cur_x += space_count * width; |
359 } | 359 } |
360 for (i=0; num_str[i] != 0; i++) { | 360 for (i=0; num_str[i] != 0; i++) { |
361 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0)); | 361 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0)); |
362 cur_x += width; | 362 cur_x += width; |
363 } | 363 } |
364 | 364 |
365 /* picture に設定 */ | 365 /* picture 荐絎 */ |
366 picture->SetSurface(surface, 0, 0); | 366 picture->SetSurface(surface, 0, 0); |
367 picture->SetSurfaceRect(Rect(0,0,width*total_count,height)); | 367 picture->SetSurfaceRect(Rect(0,0,width*total_count,height)); |
368 picture->SetSurfaceFreeFlag(); | 368 picture->SetSurfaceFreeFlag(); |
369 | 369 |
370 pic_parent->Root().DeleteSurface(surface_orig); | 370 pic_parent->Root().DeleteSurface(surface_orig); |
379 anm->Abort(); | 379 anm->Abort(); |
380 delete anm; | 380 delete anm; |
381 anm = NULL; | 381 anm = NULL; |
382 } | 382 } |
383 if (gan_name.empty()) return; | 383 if (gan_name.empty()) return; |
384 /* アニーメション情報 (.GAN ファイル)を求める */ | 384 /* ≪若<激с恰 (.GAN <ゃ)羆 */ |
385 string path(gan_name); | 385 string path(gan_name); |
386 path += ".gan"; | 386 path += ".gan"; |
387 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::GAN, path.c_str(), "gan"); | 387 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::GAN, path.c_str(), "gan"); |
388 if (info == NULL) { | 388 if (info == NULL) { |
389 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); | 389 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); |
397 } | 397 } |
398 | 398 |
399 attr = Attribute(attr | UPDATE_POS); | 399 attr = Attribute(attr | UPDATE_POS); |
400 | 400 |
401 const char* buf = data + 16; | 401 const char* buf = data + 16; |
402 buf += strlen(buf) + 1; // 画像ファイル名が入っている | 402 buf += strlen(buf) + 1; // 糸<ゃャc |
403 buf += 4; // 定数 20000 | 403 buf += 4; // 絎 20000 |
404 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数 | 404 int pics = read_little_endian_int(buf); buf += 4; // 茲違≪<若激с恰宴ャc翫掩 |
405 // 以下、pics 回繰り返し | 405 // 篁ヤpics 膵違菴 |
406 // アニメーションを行う実体を作成 | 406 // ≪<若激с潟茵絎篏篏 |
407 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | 407 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); |
408 | 408 |
409 if (event_number && event_number < pics) { // 複数のアニメーション情報がある場合、先の情報を読み飛ばす */ | 409 if (event_number && event_number < pics) { // 茲違≪<若激с恰宴翫宴茯翠違 */ |
410 int i; for (i=0; i<event_number; i++) { | 410 int i; for (i=0; i<event_number; i++) { |
411 buf += 4; // 定数 30000 | 411 buf += 4; // 絎 30000 |
412 int ptns = read_little_endian_int(buf); buf += 4; | 412 int ptns = read_little_endian_int(buf); buf += 4; |
413 buf += ptns*52; | 413 buf += ptns*52; |
414 } | 414 } |
415 } | 415 } |
416 buf += 4; // 定数 30000 | 416 buf += 4; // 絎 30000 |
417 int ptns = read_little_endian_int(buf); buf += 4; | 417 int ptns = read_little_endian_int(buf); buf += 4; |
418 int total_time = 0; | 418 int total_time = 0; |
419 int i; | 419 int i; |
420 for (i=0; i<ptns; i++) { | 420 for (i=0; i<ptns; i++) { |
421 int p = read_little_endian_int(buf+i*52+0*8+4); | 421 int p = read_little_endian_int(buf+i*52+0*8+4); |
423 int y = read_little_endian_int(buf+i*52+2*8+4); | 423 int y = read_little_endian_int(buf+i*52+2*8+4); |
424 int t = read_little_endian_int(buf+i*52+3*8+4); | 424 int t = read_little_endian_int(buf+i*52+3*8+4); |
425 int a = read_little_endian_int(buf+i*52+4*8+4); | 425 int a = read_little_endian_int(buf+i*52+4*8+4); |
426 x += PosX(); | 426 x += PosX(); |
427 y += PosY(); | 427 y += PosY(); |
428 if (p == -1) { a = 0; p = 0; } // p == -1 ならなにも表示しない | 428 if (p == -1) { a = 0; p = 0; } // p == -1 茵腓冴 |
429 if (p >= src_pos.size()) { | 429 if (p >= src_pos.size()) { |
430 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str()); | 430 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str()); |
431 a = 0; p = 0; | 431 a = 0; p = 0; |
432 } | 432 } |
433 total_time += t; | 433 total_time += t; |
434 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time)); | 434 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time)); |
435 } | 435 } |
436 wid->SetPtn(); // パターン登録終了 | 436 wid->SetPtn(); // 帥若括脂牙篋 |
437 attr = Attribute(attr | ANM_PLAYSTART); | 437 attr = Attribute(attr | ANM_PLAYSTART); |
438 anm = wid; | 438 anm = wid; |
439 } | 439 } |
440 | 440 |
441 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { | 441 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { |
447 anm->Abort(); | 447 anm->Abort(); |
448 delete anm; | 448 delete anm; |
449 anm = NULL; | 449 anm = NULL; |
450 } | 450 } |
451 | 451 |
452 // アニメーションを行う実体を作成 | 452 // ≪<若激с潟茵絎篏篏 |
453 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | 453 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); |
454 | 454 |
455 int i; | 455 int i; |
456 switch(event_number) { | 456 switch(event_number) { |
457 case 0: // pattern を 0 から最後まで変化させる | 457 case 0: // pattern 0 緇障у |
458 for (i=0; i<src_pos.size(); i++) { | 458 for (i=0; i<src_pos.size(); i++) { |
459 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i)); | 459 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i)); |
460 } | 460 } |
461 wid->SetPtn(); // パターン登録終了 | 461 wid->SetPtn(); // 帥若括脂牙篋 |
462 anm = wid; | 462 anm = wid; |
463 attr = Attribute(attr | ANM_PLAYSTART); | 463 attr = Attribute(attr | ANM_PLAYSTART); |
464 break; | 464 break; |
465 default: | 465 default: |
466 break; | 466 break; |
468 } | 468 } |
469 | 469 |
470 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { | 470 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { |
471 if (zoom == new_zoom && rotate == new_rotate) return; | 471 if (zoom == new_zoom && rotate == new_rotate) return; |
472 if ( zoom == -1 || new_zoom == -1) { | 472 if ( zoom == -1 || new_zoom == -1) { |
473 attr = Attribute(attr | UPDATE_POS); // centering する | 473 attr = Attribute(attr | UPDATE_POS); // centering |
474 } | 474 } |
475 zoom = new_zoom; | 475 zoom = new_zoom; |
476 if (new_rotate != -1) rotate = new_rotate; | 476 if (new_rotate != -1) rotate = new_rotate; |
477 if (zoom < 0) zoom = 256; | 477 if (zoom < 0) zoom = 256; |
478 if (rotate < 0) rotate = 0; | 478 if (rotate < 0) rotate = 0; |
533 | 533 |
534 /****************************************************************** | 534 /****************************************************************** |
535 ** | 535 ** |
536 ** class ScnGrp* | 536 ** class ScnGrp* |
537 */ | 537 */ |
538 /* Princess Bride: 背景画の一部のみ移動、の実装 */ | 538 /* Princess Bride: 祉筝睡Щ絎茖 */ |
539 | 539 |
540 ScnGrpMove::ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& _root, Surface* _dest, const Rect& _dest_r, Surface* _src, const Rect& _from, const Rect& _to, int total_time) : | 540 ScnGrpMove::ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& _root, Surface* _dest, const Rect& _dest_r, Surface* _src, const Rect& _from, const Rect& _to, int total_time) : |
541 WidAnmTime(container, _pic, total_time), | 541 WidAnmTime(container, _pic, total_time), |
542 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { | 542 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { |
543 int dx = to.lx - from.lx; | 543 int dx = to.lx - from.lx; |
561 for (it=pic.begin(); it!=pic.end(); it++) | 561 for (it=pic.begin(); it!=pic.end(); it++) |
562 (*it)->SetSurface(dest, 0, 0); | 562 (*it)->SetSurface(dest, 0, 0); |
563 } | 563 } |
564 | 564 |
565 void ScnGrpAnm::CalcTotal(void) { | 565 void ScnGrpAnm::CalcTotal(void) { |
566 /* total time を計算 */ | 566 /* total time 荐膊 */ |
567 if (empty()) return; | 567 if (empty()) return; |
568 int tm = 0; | 568 int tm = 0; |
569 vector<ScnGrpAnmAtom>::iterator it; | 569 vector<ScnGrpAnmAtom>::iterator it; |
570 for (it=begin(); it != end(); it++) tm += it->time; | 570 for (it=begin(); it != end(); it++) tm += it->time; |
571 total_time = tm; | 571 total_time = tm; |
881 } | 881 } |
882 } | 882 } |
883 | 883 |
884 Surface* Grp::Dsurface(int pdt) { | 884 Surface* Grp::Dsurface(int pdt) { |
885 if (pdt == 0) return surface; | 885 if (pdt == 0) return surface; |
886 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする | 886 if (dsurface[pdt] == 0) { // 脂≪紊с |
887 if (pdt == WORKPDT) | 887 if (pdt == WORKPDT) |
888 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); | 888 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); |
889 else | 889 else |
890 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | 890 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); |
891 } | 891 } |
892 if (ssurface[pdt]) { // ssurface が存在すれば、dsurface にコピーして返す | 892 if (ssurface[pdt]) { // ssurface 絖違dsurface 潟若菴 |
893 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0)); | 893 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0)); |
894 parent.Root().DeleteSurface(ssurface[pdt]); | 894 parent.Root().DeleteSurface(ssurface[pdt]); |
895 ssurface[pdt] = 0; | 895 ssurface[pdt] = 0; |
896 } | 896 } |
897 return dsurface[pdt]; | 897 return dsurface[pdt]; |
941 } | 941 } |
942 if (bg != NULL) { | 942 if (bg != NULL) { |
943 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); | 943 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); |
944 ssurface[pdt] = bg; | 944 ssurface[pdt] = bg; |
945 if (pdt == 0) { | 945 if (pdt == 0) { |
946 /* とりあえず Princess Bride のアニメーション効果専用 */ | 946 /* Princess Bride ≪<若激с喝号絨 */ |
947 Rect r(*ssurface[0]); | 947 Rect r(*ssurface[0]); |
948 Rect dr(*surface); | 948 Rect dr(*surface); |
949 int x = (dr.width()-r.width())/2; | 949 int x = (dr.width()-r.width())/2; |
950 int y = (dr.height()-r.height())/2; | 950 int y = (dr.height()-r.height())/2; |
951 DSurfaceMove(ssurface[0], r, surface, Rect(x,y)); | 951 DSurfaceMove(ssurface[0], r, surface, Rect(x,y)); |
1044 anm1->Abort(); | 1044 anm1->Abort(); |
1045 delete anm1; | 1045 delete anm1; |
1046 anm1 = NULL; | 1046 anm1 = NULL; |
1047 } | 1047 } |
1048 map<int,GrpObj>::iterator it; | 1048 map<int,GrpObj>::iterator it; |
1049 // 現在表示中のobjectを消去 | 1049 // 憜茵腓坂賢object羔サ |
1050 deleted_pic.push_back(screen); | 1050 deleted_pic.push_back(screen); |
1051 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | 1051 for (it=grpobj.begin(); it!=grpobj.end(); it++) { |
1052 if (! (it->second.attr & GrpObj::WIPEON)) { // 画像切り替え時に object 削除 | 1052 if (! (it->second.attr & GrpObj::WIPEON)) { // 糸帥 object |
1053 deleted_pic.push_back(it->second.DeletePic()); | 1053 deleted_pic.push_back(it->second.DeletePic()); |
1054 } else { | 1054 } else { |
1055 GrpObj& new_obj = bs_obj[it->first]; | 1055 GrpObj& new_obj = bs_obj[it->first]; |
1056 if (new_obj.name.empty()) { // 新しい object が存在しなければ内容を引き継ぐ | 1056 if (new_obj.name.empty()) { // 違 object 絖医絎鴻綣膓 |
1057 new_obj = it->second; | 1057 new_obj = it->second; |
1058 it->second.DeletePic(); | 1058 it->second.DeletePic(); |
1059 } else { | 1059 } else { |
1060 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON); | 1060 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON); |
1061 deleted_pic.push_back(it->second.DeletePic()); | 1061 deleted_pic.push_back(it->second.DeletePic()); |
1062 } | 1062 } |
1063 } | 1063 } |
1064 } | 1064 } |
1065 grpobj.clear(); // 全オブジェクト削除 | 1065 grpobj.clear(); // 吾с |
1066 | 1066 |
1067 // 全画像オブジェクトの前にscreen 移動 | 1067 // 糸吾сscreen 腱糸 |
1068 // 新しい screen_front を作成しておく | 1068 // 違 screen_front 篏 |
1069 screen = screen_front; | 1069 screen = screen_front; |
1070 screen->hide(); | 1070 screen->hide(); |
1071 screen->SetSurface(surface_update, 0, 0); | 1071 screen->SetSurface(surface_update, 0, 0); |
1072 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0)); | 1072 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0)); |
1073 | 1073 |
1074 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | 1074 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); |
1075 screen_front->hide(); | 1075 screen_front->hide(); |
1076 screen_front->ZMove(screen); | 1076 screen_front->ZMove(screen); |
1077 | 1077 |
1078 // 新しい object へ更新、surface_update へ新しい object を表示 | 1078 // 違 object 御贋違surface_update 御違 object 茵腓 |
1079 // (object 作成時は picture は hide されている) | 1079 // (object 篏 picture hide ) |
1080 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { | 1080 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { |
1081 grpobj[it->first] = it->second; | 1081 grpobj[it->first] = it->second; |
1082 it->second.DeletePic(); | 1082 it->second.DeletePic(); |
1083 CreateObj(it->first);//FIXME: Adapt to groups | 1083 CreateObj(it->first);//FIXME: Adapt to groups |
1084 GrpObj& g = grpobj[it->first]; | 1084 GrpObj& g = grpobj[it->first]; |
1088 else g.picture->SimpleBlit(surface_update); | 1088 else g.picture->SimpleBlit(surface_update); |
1089 g.picture->hide(); | 1089 g.picture->hide(); |
1090 } | 1090 } |
1091 } | 1091 } |
1092 bs_obj.clear(); | 1092 bs_obj.clear(); |
1093 // 画像効果開始 | 1093 // 糸号紮 |
1094 switch(sel.sel_no) { | 1094 switch(sel.sel_no) { |
1095 default: | 1095 default: |
1096 case 0: case 50: // 0 と 50 の違いが良くわからない | 1096 case 0: case 50: // 0 50 |
1097 if (skip_mode & SKIP_GRP_NOEFFEC) | 1097 if (skip_mode & SKIP_GRP_NOEFFEC) |
1098 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0); | 1098 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0); |
1099 else if (skip_mode & SKIP_GRP_FAST) | 1099 else if (skip_mode & SKIP_GRP_FAST) |
1100 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4); | 1100 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4); |
1101 else | 1101 else |
1112 anm2->Abort(); | 1112 anm2->Abort(); |
1113 delete anm2; | 1113 delete anm2; |
1114 anm2 = NULL; | 1114 anm2 = NULL; |
1115 } | 1115 } |
1116 if (skip_mode & SKIP_GRP_NOEFFEC) return; | 1116 if (skip_mode & SKIP_GRP_NOEFFEC) return; |
1117 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen では元画面の座標を揺らす | 1117 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen с脂≪綺ф寚 |
1118 int i; | 1118 int i; |
1119 int tm = 0; | 1119 int tm = 0; |
1120 for (i=0; i<total; i+=3) { | 1120 for (i=0; i<total; i+=3) { |
1121 int x = pattern[i]; | 1121 int x = pattern[i]; |
1122 int y = pattern[i+1]; | 1122 int y = pattern[i+1]; |
1123 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm)); | 1123 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm)); |
1124 tm += pattern[i+2]; | 1124 tm += pattern[i+2]; |
1125 } | 1125 } |
1126 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm)); | 1126 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm)); |
1127 new_anm->SetPtn(); // パターン登録終了 | 1127 new_anm->SetPtn(); // 帥若括脂牙篋 |
1128 new_anm->Play(); | 1128 new_anm->Play(); |
1129 anm2 = new_anm; | 1129 anm2 = new_anm; |
1130 } | 1130 } |
1131 | 1131 |
1132 void Grp::AbortAnm(void) { | 1132 void Grp::AbortAnm(void) { |
1133 if (anm1 == NULL) return; | 1133 if (anm1 == NULL) return; |
1134 anm1->Abort(); | 1134 anm1->Abort(); |
1135 delete anm1; | 1135 delete anm1; |
1136 anm1 = NULL; | 1136 anm1 = NULL; |
1137 /* 画像効果終了 */ | 1137 /* 糸号腟篋 */ |
1138 /* 古い画面への画像効果があれば消去 */ | 1138 /* ゃ脂≪吾糸号井サ */ |
1139 if (anm2 && anm2->pic[0] != screen) { | 1139 if (anm2 && anm2->pic[0] != screen) { |
1140 anm2->Abort(); | 1140 anm2->Abort(); |
1141 delete anm2; | 1141 delete anm2; |
1142 anm2 = NULL; | 1142 anm2 = NULL; |
1143 } | 1143 } |
1144 /* pdt1 -> pdt0 へコピー */ | 1144 /* pdt1 -> pdt0 吾潟 */ |
1145 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0)); | 1145 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0)); |
1146 screen->SetSurface(surface, 0, 0); | 1146 screen->SetSurface(surface, 0, 0); |
1147 // 画像効果開始時に存在したobjectを消去 | 1147 // 糸号紮絖object羔サ |
1148 // 新しい object 表示 | 1148 // 違 object 茵腓 |
1149 RefreshObj(); | 1149 RefreshObj(); |
1150 return; | 1150 return; |
1151 } | 1151 } |
1152 | 1152 |
1153 void Grp::LoadSurface(const char* str) { | 1153 void Grp::LoadSurface(const char* str) { |
1154 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 | 1154 if (anm1 != NULL) AbortAnm(); // 祉腟c医七句篋 |
1155 LoadSurface(str, 1); | 1155 LoadSurface(str, 1); |
1156 bg_name = str; | 1156 bg_name = str; |
1157 } | 1157 } |
1158 | 1158 |
1159 void Grp::LoadSurface(void) { | 1159 void Grp::LoadSurface(void) { |
1160 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 | 1160 if (anm1 != NULL) AbortAnm(); // 祉腟c医七句篋 |
1161 LoadSurface(bg_name.c_str(), 1); | 1161 LoadSurface(bg_name.c_str(), 1); |
1162 } | 1162 } |
1163 | 1163 |
1164 void Grp::AddSurface(const char* str) { | 1164 void Grp::AddSurface(const char* str) { |
1165 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 | 1165 if (anm1 != NULL) AbortAnm(); // 祉腟c医七句篋 |
1166 LoadSurface(bg_name.c_str()); | 1166 LoadSurface(bg_name.c_str()); |
1167 | 1167 |
1168 string s = str; | 1168 string s = str; |
1169 Surface* front = parent.Root().NewSurface(s.c_str()); | 1169 Surface* front = parent.Root().NewSurface(s.c_str()); |
1170 if (front == NULL) { | 1170 if (front == NULL) { |
1183 GrpObjMap::iterator cur = grpobj.find(index); | 1183 GrpObjMap::iterator cur = grpobj.find(index); |
1184 if (cur == grpobj.end()) return; | 1184 if (cur == grpobj.end()) return; |
1185 GrpObj& g = grpobj[index]; | 1185 GrpObj& g = grpobj[index]; |
1186 g.CreateSurface(&parent); | 1186 g.CreateSurface(&parent); |
1187 g.order = index; | 1187 g.order = index; |
1188 if (g.picture == NULL) return; // エラー:surface が存在しない | 1188 if (g.picture == NULL) return; // 種surface 絖 |
1189 g.picture->hide(); | 1189 g.picture->hide(); |
1190 SetObjChanged(index); | 1190 SetObjChanged(index); |
1191 ZMoveObj(index); | 1191 ZMoveObj(index); |
1192 } | 1192 } |
1193 | 1193 |
1198 cur = g->children_obj.find(index); | 1198 cur = g->children_obj.find(index); |
1199 if (cur == g->children_obj.end()) return; | 1199 if (cur == g->children_obj.end()) return; |
1200 g = &g->children_obj[index]; | 1200 g = &g->children_obj[index]; |
1201 g->CreateSurface(&parent); | 1201 g->CreateSurface(&parent); |
1202 g->order = index; | 1202 g->order = index; |
1203 if (g->picture == NULL) return; // エラー:surface が存在しない | 1203 if (g->picture == NULL) return; // 種surface 絖 |
1204 g->picture->hide(); | 1204 g->picture->hide(); |
1205 //TODO | 1205 //TODO |
1206 SetObjChanged(grp_index); | 1206 SetObjChanged(grp_index); |
1207 /*ZMoveObj(index);*/ | 1207 /*ZMoveObj(index);*/ |
1208 } | 1208 } |
1210 void Grp::ZMoveObj(int index) { | 1210 void Grp::ZMoveObj(int index) { |
1211 GrpObjMap::iterator cur = grpobj.find(index); | 1211 GrpObjMap::iterator cur = grpobj.find(index); |
1212 if (cur == grpobj.end()) return; | 1212 if (cur == grpobj.end()) return; |
1213 GrpObj& g = grpobj[index]; | 1213 GrpObj& g = grpobj[index]; |
1214 if (g.picture == NULL) return; | 1214 if (g.picture == NULL) return; |
1215 // 自分より前に object があれば、その前に表示 | 1215 // object 違茵腓 |
1216 // そうでなければ screen の前に表示 | 1216 // с screen 茵腓 |
1217 GrpObjMap::iterator cur_backobj = grpobj.end(); | 1217 GrpObjMap::iterator cur_backobj = grpobj.end(); |
1218 GrpObjMap::iterator it; | 1218 GrpObjMap::iterator it; |
1219 for (it = grpobj.begin(); it != grpobj.end(); it++) { | 1219 for (it = grpobj.begin(); it != grpobj.end(); it++) { |
1220 if (it == cur) continue; | 1220 if (it == cur) continue; |
1221 if (it->second.picture == NULL) continue; | 1221 if (it->second.picture == NULL) continue; |
1233 g.picture->ZMove(cur_backobj->second.picture); | 1233 g.picture->ZMove(cur_backobj->second.picture); |
1234 } | 1234 } |
1235 } | 1235 } |
1236 | 1236 |
1237 void Grp::SwapObj(int index1, int index2) { | 1237 void Grp::SwapObj(int index1, int index2) { |
1238 // デフォルト値から order が変更されていた場合のみ、order は保存される | 1238 // ゃ order 紊眼翫帥order 篆絖 |
1239 // まずは両方のobjectをswap | 1239 // 障筝≧鴻objectswap |
1240 if (grpobj.find(index1) == grpobj.end()) { | 1240 if (grpobj.find(index1) == grpobj.end()) { |
1241 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない | 1241 if (grpobj.find(index2) == grpobj.end()) return; // < object 絖 |
1242 grpobj[index1] = grpobj[index2]; | 1242 grpobj[index1] = grpobj[index2]; |
1243 if (grpobj[index1].order == index2) | 1243 if (grpobj[index1].order == index2) |
1244 grpobj[index1].order = index1; | 1244 grpobj[index1].order = index1; |
1245 grpobj[index2].DeletePic(); | 1245 grpobj[index2].DeletePic(); |
1246 grpobj.erase(index2); | 1246 grpobj.erase(index2); |
1247 ZMoveObj(index1); | 1247 ZMoveObj(index1); |
1248 return; | 1248 return; |
1249 } else if (grpobj.find(index2) == grpobj.end()) { // index2 が存在しない場合 | 1249 } else if (grpobj.find(index2) == grpobj.end()) { // index2 絖翫 |
1250 grpobj[index2] = grpobj[index1]; | 1250 grpobj[index2] = grpobj[index1]; |
1251 if (grpobj[index2].order == index1) | 1251 if (grpobj[index2].order == index1) |
1252 grpobj[index2].order = index2; | 1252 grpobj[index2].order = index2; |
1253 grpobj[index1].DeletePic(); | 1253 grpobj[index1].DeletePic(); |
1254 grpobj.erase(index1); | 1254 grpobj.erase(index1); |
1267 ZMoveObj(index2); | 1267 ZMoveObj(index2); |
1268 obj.DeletePic(); | 1268 obj.DeletePic(); |
1269 } | 1269 } |
1270 } | 1270 } |
1271 | 1271 |
1272 bool Grp::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル | 1272 bool Grp::Pressed(int x, int y, void* pointer) { // 鴻сc潟祉 |
1273 Grp* g = (Grp*)pointer; | 1273 Grp* g = (Grp*)pointer; |
1274 if (g->status == WAIT_MOVIE) | 1274 if (g->status == WAIT_MOVIE) |
1275 g->music->StopMovie(); | 1275 g->music->StopMovie(); |
1276 if (g->status == WAIT_ANM) | 1276 if (g->status == WAIT_ANM) |
1277 g->AbortAnm(); | 1277 g->AbortAnm(); |
1281 g->anm2 = NULL; | 1281 g->anm2 = NULL; |
1282 } | 1282 } |
1283 return false; // event deleted | 1283 return false; // event deleted |
1284 } | 1284 } |
1285 | 1285 |
1286 /* mode.cgm の decode 用 */ | 1286 /* mode.cgm decode */ |
1287 static unsigned char decode_char[256] = { | 1287 static unsigned char decode_char[256] = { |
1288 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44, | 1288 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44, |
1289 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33, | 1289 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33, |
1290 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45, | 1290 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45, |
1291 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec, | 1291 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec, |
1318 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, | 1318 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, |
1319 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 | 1319 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 |
1320 }; | 1320 }; |
1321 | 1321 |
1322 void Grp::LoadCgm() { | 1322 void Grp::LoadCgm() { |
1323 /* cgm ファイル読み込み */ | 1323 /* cgm <ゃ茯粋昭 */ |
1324 const char* fname = config->GetParaStr("#CGTABLE_FILE"); | 1324 const char* fname = config->GetParaStr("#CGTABLE_FILE"); |
1325 if (fname == NULL) return; | 1325 if (fname == NULL) return; |
1326 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, ""); | 1326 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, ""); |
1327 if (info == NULL) return; | 1327 if (info == NULL) return; |
1328 char* data = info->CopyRead(); | 1328 char* data = info->CopyRead(); |
1335 return; | 1335 return; |
1336 } | 1336 } |
1337 cgm_size = read_little_endian_int(data+0x10); | 1337 cgm_size = read_little_endian_int(data+0x10); |
1338 | 1338 |
1339 int i, j; | 1339 int i, j; |
1340 // xor 解除 | 1340 // xor 茹i |
1341 for (i=0; i < sz-0x20; i++) { | 1341 for (i=0; i < sz-0x20; i++) { |
1342 data[i+0x20]^=decode_char[i&0xff]; | 1342 data[i+0x20]^=decode_char[i&0xff]; |
1343 } | 1343 } |
1344 // 展開 | 1344 // 絮 |
1345 int dest_size = cgm_size * 36; | 1345 int dest_size = cgm_size * 36; |
1346 char* dest = new char[dest_size+1024]; | 1346 char* dest = new char[dest_size+1024]; |
1347 char* src = data + 0x28; | 1347 char* src = data + 0x28; |
1348 char* dest_orig = dest; | 1348 char* dest_orig = dest; |
1349 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz); | 1349 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz); |
1357 delete[] dest_orig; | 1357 delete[] dest_orig; |
1358 } | 1358 } |
1359 | 1359 |
1360 /***************************************************** | 1360 /***************************************************** |
1361 * | 1361 * |
1362 * Grp :: Save, Load : セーブファイル処理 | 1362 * Grp :: Save, Load : 祉若<ゃ |
1363 * | 1363 * |
1364 */ | 1364 */ |
1365 void Grp::Save(std::string& str) { | 1365 void Grp::Save(std::string& str) { |
1366 } | 1366 } |
1367 | 1367 |
1424 } | 1424 } |
1425 | 1425 |
1426 | 1426 |
1427 /***************************************************** | 1427 /***************************************************** |
1428 * | 1428 * |
1429 * Grp :: Wait , Exec : コマンド実行部 | 1429 * Grp :: Wait , Exec : 潟潟絎茵 |
1430 * | 1430 * |
1431 */ | 1431 */ |
1432 static vector<int> drawn_images; | 1432 static vector<int> drawn_images; |
1433 static int draw_n = 0; | 1433 static int draw_n = 0; |
1434 extern bool grpdump_req; | 1434 extern bool grpdump_req; |
1507 } | 1507 } |
1508 } | 1508 } |
1509 return false; | 1509 return false; |
1510 } | 1510 } |
1511 | 1511 |
1512 void Grp::DeleteObjPic(int num) { // object の surface のみ削除 | 1512 void Grp::DeleteObjPic(int num) { // object surface 水 |
1513 if (grpobj.find(num) == grpobj.end()) return; | 1513 if (grpobj.find(num) == grpobj.end()) return; |
1514 deleted_pic.push_back(grpobj[num].DeletePic()); | 1514 deleted_pic.push_back(grpobj[num].DeletePic()); |
1515 } | 1515 } |
1516 | 1516 |
1517 void Grp::DeleteSubObjPic(int num_grp, int num) { | 1517 void Grp::DeleteSubObjPic(int num_grp, int num) { |
1537 grpobj[num_grp].children_obj.erase(num); | 1537 grpobj[num_grp].children_obj.erase(num); |
1538 } | 1538 } |
1539 | 1539 |
1540 void Grp::Exec(Cmd& cmd) { | 1540 void Grp::Exec(Cmd& cmd) { |
1541 if (cmd.cmd_type == CMD_TEXTEND) { | 1541 if (cmd.cmd_type == CMD_TEXTEND) { |
1542 music->StopKoe(500); // テキスト終了で声を止める | 1542 music->StopKoe(500); // 鴻腟篋у0罩≪ |
1543 cmd.clear(); | 1543 cmd.clear(); |
1544 return; | 1544 return; |
1545 } | 1545 } |
1546 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { | 1546 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { |
1547 // wait する場合は RefreshObj() しておく | 1547 // wait 翫 RefreshObj() |
1548 RefreshObj(); | 1548 RefreshObj(); |
1549 } | 1549 } |
1550 if (cmd.cmd_type != CMD_OTHER) return; | 1550 if (cmd.cmd_type != CMD_OTHER) return; |
1551 | 1551 |
1552 CommandHandler::Exec(cmd); | 1552 CommandHandler::Exec(cmd); |
1553 | 1553 |
1554 //TODO: ??? | 1554 //TODO: ??? |
1555 if (cmd.cmd1 == 1 && cmd.cmd2 == 60 && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除? | 1555 if (cmd.cmd1 == 1 && cmd.cmd2 == 60 && cmd.cmd3 == 0) { // ??? : KANOGI : 糸吾сわ |
1556 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 | 1556 DeleteObjPic(cmd.args[0].value); // с<ゃsurface |
1557 GrpObj& g = grpobj[cmd.args[0].value]; | 1557 GrpObj& g = grpobj[cmd.args[0].value]; |
1558 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | 1558 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); |
1559 cmd.clear(); | 1559 cmd.clear(); |
1560 } | 1560 } |
1561 | 1561 |