33 d_length = d_height = currentsubmap_ = posx_ = posy_ = 0;
43 Py_XDECREF (schedule_args);
104 return set_pos (sm, npx, npy, nox, noy);
191 PyObject * args = NULL;
210 currentsubmap_ >> file;
235 Py_XDECREF (schedule_args);
236 schedule_args = NULL;
241 schedule_args = args;
243 u_int16 argssize = args == NULL ? 1 : PyTuple_Size (args) + 1;
246 theargs = PyTuple_New (argssize);
251 for (
u_int16 i = 1; i < argssize; i++)
253 PyObject * intref = PyTuple_GetItem (args, i - 1);
255 PyTuple_SetItem (theargs, i, intref);
257 schedule.
create_instance (
"schedules.mapviews." + file, file, theargs);
260 schedule_file_ = file;
275 static list <mapsquare_tile>::iterator it;
276 static list <mapsquare_char>::iterator itc;
277 static list <mapcharacter *>::iterator itb;
281 static list <mapsquare_tile> critical_draw;
282 static list <mapsquare_char> characters_draw;
283 static list <mapcharacter *> bubbles_draw;
288 static SDL_Rect trect;
297 l = m_map->submap[currentsubmap_];
303 ie = i0 + d_length + (offx_ != 0) < l->
area_length () ? i0 + d_length + (offx_ !=
305 je = j0 + d_height + (offy_ != 0) < l->
area_height () ? j0 + d_height + (offy_ !=
319 for (it = l->area[i0][j0].tiles.begin ();
320 it != l->area[i0][j0].tiles.end () && *(it->base_tile) < *it; it++)
321 if (it->x > it->base_tile->x && it->y > it->base_tile->y)
322 critical_draw.push_back (*(it->base_tile));
324 for (itc = l->area[i0][j0].mapchars.begin ();
325 itc != l->area[i0][j0].mapchars.end (); itc++)
326 if (itc->x > itc->base_tile->x && itc->y > itc->base_tile->y)
327 characters_draw.push_back (*itc);
332 for (it = l->area[i][j0].tiles.begin ();
333 it != l->area[i][j0].tiles.end (); it++)
334 if (it->x == it->base_tile->x && it->y > it->base_tile->y)
335 critical_draw.push_back (*(it->base_tile));
337 for (itc = l->area[i][j0].mapchars.begin ();
338 itc != l->area[i][j0].mapchars.end (); itc++)
339 if (itc->x == itc->base_tile->x && itc->y > itc->base_tile->y)
340 characters_draw.push_back (*itc);
344 for (it = l->area[ie - 1][j0].tiles.begin ();
345 it != l->area[ie - 1][j0].tiles.end (); it++)
346 if (it->x < it->base_tile->x && it->y > it->base_tile->y)
347 critical_draw.push_back (*(it->base_tile));
349 for (itc = l->area[ie - 1][j0].mapchars.begin ();
350 itc != l->area[ie - 1][j0].mapchars.end (); itc++)
351 if (itc->x < itc->base_tile->x && itc->y > itc->base_tile->y)
352 characters_draw.push_back (*itc);
355 critical_draw.sort ();
356 characters_draw.sort ();
358 it = critical_draw.begin ();
359 itc = characters_draw.begin ();
360 while (itc != characters_draw.end () || it != critical_draw.end ())
362 if (itc != characters_draw.end ())
364 if (it != critical_draw.end ())
366 if (it->base_tile->y <= itc->base_tile->y)
368 draw_tile (x, y, &tda, target, it);
373 draw_mapchar (x, y, &tda, target, itc);
374 if (itc->mchar->is_speaking ())
375 bubbles_draw.push_back (itc->mchar);
381 draw_mapchar (x, y, &tda, target, itc);
382 if (itc->mchar->is_speaking ())
383 bubbles_draw.push_back (itc->mchar);
389 draw_tile (x, y, &tda, target, it);
393 critical_draw.clear ();
394 characters_draw.clear ();
397 for (j = j0; j < je; j++)
400 for (it = l->area[i0][j].tiles.begin ();
401 it != l->area[i0][j].tiles.end () && *(it->base_tile) <= *it;
403 if (it->y == it->base_tile->y && it->x > it->base_tile->x)
404 draw_tile (x, y, &tda, target, it);
406 for (itc = l->area[i0][j].mapchars.begin ();
407 itc != l->area[i0][j].mapchars.end (); itc++)
408 if (itc->y == itc->base_tile->y && itc->x > itc->base_tile->x)
409 characters_draw.push_back (*itc);
412 for (i = i0; i < ie; i++)
414 for (it = l->area[i][j].base_begin;
415 it != l->area[i][j].tiles.end () && *(it->base_tile) < *it;
417 for (; it != l->area[i][j].tiles.end () && *(it->base_tile) == *it;
419 draw_tile (x, y, &tda, target, it);
421 for (itc = l->area[i][j].mapchars.begin ();
422 itc != l->area[i][j].mapchars.end (); itc++)
423 if (*itc == *(itc->base_tile) &&
424 itc->x == itc->mchar->posx () &&
425 itc->y == itc->mchar->posy ())
426 characters_draw.push_back (*itc);
430 for (it = l->area[ie - 1][j].tiles.begin ();
431 it != l->area[ie - 1][j].tiles.end (); it++)
432 if (it->y == it->base_tile->y && it->x < it->base_tile->x)
433 draw_tile (x, y, &tda, target, it);
435 for (itc = l->area[ie - 1][j].mapchars.begin ();
436 itc != l->area[ie - 1][j].mapchars.end (); itc++)
437 if (itc->y == itc->base_tile->y && itc->x < itc->base_tile->x)
438 characters_draw.push_back (*itc);
441 for (itc = characters_draw.begin (); itc != characters_draw.end ();
444 draw_mapchar (x, y, &tda, target, itc);
445 if (itc->mchar->is_speaking ())
446 bubbles_draw.push_back (itc->mchar);
448 characters_draw.clear ();
453 if (!l->area[i0][je - 1].tiles.empty ())
454 for (it = --l->area[i0][je - 1].tiles.end ();
455 it->y < it->base_tile->y; it--)
457 if (it->x > it->base_tile->x && it->y < it->base_tile->y)
458 critical_draw.push_front (*(it->base_tile));
459 if (it == l->area[i0][je - 1].tiles.begin ())
463 for (itc = l->area[i0][je - 1].mapchars.begin ();
464 itc != l->area[i0][je - 1].mapchars.end (); itc++)
465 if (itc->x > itc->base_tile->x && itc->y < itc->base_tile->y)
466 characters_draw.push_back (*itc);
471 if (!l->area[i][je - 1].tiles.empty ())
472 for (it = --l->area[i][je - 1].tiles.end ();
473 it->y < it->base_tile->y; it--)
475 if (it->x == it->base_tile->x && it->y < it->base_tile->y)
476 critical_draw.push_front (*(it->base_tile));
477 if (it == l->area[i][je - 1].tiles.begin ())
481 for (itc = l->area[i][je - 1].mapchars.begin ();
482 itc != l->area[i][je - 1].mapchars.end (); itc++)
484 if (itc->x == itc->base_tile->x && itc->y < itc->base_tile->y)
486 characters_draw.push_back (*itc);
492 if (!l->area[ie - 1][je - 1].tiles.empty ())
493 for (it = --l->area[ie - 1][je - 1].tiles.end ();
494 it->y < it->base_tile->y; it--)
496 if (it->x < it->base_tile->x && it->y < it->base_tile->y)
497 critical_draw.push_front (*(it->base_tile));
498 if (it == l->area[ie - 1][je - 1].tiles.begin ())
502 for (itc = l->area[ie - 1][je - 1].mapchars.begin ();
503 itc != l->area[ie - 1][je - 1].mapchars.end (); itc++)
504 if (itc->x < itc->base_tile->x && itc->y < itc->base_tile->y)
505 characters_draw.push_back (*itc);
509 critical_draw.sort ();
510 characters_draw.sort ();
512 it = critical_draw.begin ();
513 itc = characters_draw.begin ();
514 while (itc != characters_draw.end () || it != critical_draw.end ())
516 if (itc != characters_draw.end ())
518 if (it != critical_draw.end ())
520 if (it->base_tile->y <= itc->base_tile->y)
522 draw_tile (x, y, &tda, target, it);
527 draw_mapchar (x, y, &tda, target, itc);
528 if (itc->mchar->is_speaking ())
529 bubbles_draw.push_back (itc->mchar);
535 draw_mapchar (x, y, &tda, target, itc);
536 if (itc->mchar->is_speaking ())
537 bubbles_draw.push_back (itc->mchar);
543 draw_tile (x, y, &tda, target, it);
548 for (itb = bubbles_draw.begin (); itb != bubbles_draw.end (); itb++)
549 draw_bubble (x, y, &tda, target, itb);
551 critical_draw.clear ();
552 characters_draw.clear ();
553 bubbles_draw.clear ();
564 surface * target, list<mapsquare_tile>::iterator it)
const
566 it->mapobj->draw_from_base
573 surface * target, list<mapsquare_char>::iterator itc)
const
576 ((itc->mchar->posx () - posx_ - itc->mchar->base_x ()) *
MAPSQUARE_SIZE)
577 + itc->mchar->offx () - offx_ + x;
580 ((itc->mchar->posy () - posy_ - itc->mchar->base_y ()) *
MAPSQUARE_SIZE)
581 + itc->mchar->offy () - offy_ + y;
583 itc->mchar->draw (xdraw, ydraw, da_opt, target);
587 surface * target, list<mapcharacter *>::iterator itc)
const
591 + (*itc)->offx () - offx_ + x;
595 + (*itc)->offy () - offy_ + y;
597 (*itc)->draw_bubble (xdraw, ydraw, da_opt, target);