forked from EasyRPG/Player
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawable.cpp
96 lines (87 loc) · 2.62 KB
/
drawable.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
* This file is part of EasyRPG Player.
*
* EasyRPG Player is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Player is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
*/
#include "drawable.h"
#include <lcf/rpg/savepicture.h>
#include "drawable_mgr.h"
Drawable::~Drawable() {
DrawableMgr::Remove(this);
}
void Drawable::SetZ(Z_t nz) {
if (_z != nz) DrawableMgr::OnUpdateZ(this);
_z = nz;
}
Drawable::Z_t Drawable::GetPriorityForMapLayer(int which) {
Z_t layer = 0;
switch (which) {
case lcf::rpg::SavePicture::MapLayer_parallax:
layer = Priority_Background;
break;
case lcf::rpg::SavePicture::MapLayer_tilemap_below:
layer = Priority_TilesetBelow;
break;
case lcf::rpg::SavePicture::MapLayer_events_below:
layer = Priority_EventsBelow;
break;
case lcf::rpg::SavePicture::MapLayer_events_same_as_player:
layer = Priority_Player;
break;
case lcf::rpg::SavePicture::MapLayer_tilemap_above:
layer = Priority_TilesetAbove;
break;
case lcf::rpg::SavePicture::MapLayer_events_above:
layer = Priority_EventsFlying;
break;
case lcf::rpg::SavePicture::MapLayer_weather:
layer = Priority_PictureNew;
break;
case lcf::rpg::SavePicture::MapLayer_animations:
layer = Priority_BattleAnimation;
break;
case lcf::rpg::SavePicture::MapLayer_windows:
layer = Priority_Window;
break;
case lcf::rpg::SavePicture::MapLayer_timers:
layer = Priority_Timer;
break;
default:
return layer;
}
return layer + (1ULL << z_offset);
}
Drawable::Z_t Drawable::GetPriorityForBattleLayer(int which) {
Z_t layer = 0;
switch (which) {
case lcf::rpg::SavePicture::BattleLayer_background:
layer = Priority_Background;
break;
case lcf::rpg::SavePicture::BattleLayer_battlers_and_animations:
layer = Priority_Battler;
break;
case lcf::rpg::SavePicture::BattleLayer_weather:
layer = Priority_PictureNew;
break;
case lcf::rpg::SavePicture::BattleLayer_windows_and_status:
layer = Priority_Window;
break;
case lcf::rpg::SavePicture::BattleLayer_timers:
layer = Priority_Timer;
break;
default:
return layer;
}
return layer + (1ULL << z_offset);
}