Commit | Line | Data |
---|---|---|
8893218a TGR |
1 | From: Tobias Geerinckx-Rice <me@tobias.gr> |
2 | Date: Tue, 19 Jun 2018 04:37:46 +0200 | |
3 | Subject: gnu: mrrescue: Support Love 11. | |
4 | ||
5 | The patch below was copied verbatim from an as-yet-unmerged PR[0] to | |
6 | make Mr. Rescue run on a newer version of the Löve engine. | |
7 | ||
8 | [0]: https://github.com/SimonLarsen/mrrescue/pull/17 | |
9 | --- | |
10 | From ab23031e0c2faecb77fde1be8a41d6f8ea4e6eda Mon Sep 17 00:00:00 2001 | |
11 | From: Mystro256 <alexjnewt@hotmail.com> | |
12 | Date: Sun, 10 Jun 2018 21:19:23 -0400 | |
13 | Subject: [PATCH] Love 11 support | |
14 | ||
15 | --- | |
16 | conf.lua | 2 +- | |
17 | config.lua | 6 +++--- | |
18 | highscore_entry.lua | 4 ++-- | |
19 | highscore_list.lua | 4 ++-- | |
20 | ingame.lua | 6 +++--- | |
21 | ingame_menu.lua | 4 ++-- | |
22 | joystick.lua | 4 ++-- | |
23 | main.lua | 2 +- | |
24 | resources.lua | 4 ++-- | |
25 | util.lua | 4 ++-- | |
26 | 10 files changed, 20 insertions(+), 20 deletions(-) | |
27 | ||
28 | diff --git a/conf.lua b/conf.lua | |
29 | index 8776da4..f00b216 100644 | |
30 | --- a/conf.lua | |
31 | +++ b/conf.lua | |
32 | @@ -1,6 +1,6 @@ | |
33 | function love.conf(t) | |
34 | t.identity = "mrrescue" | |
35 | - t.version = "0.10.0" | |
36 | + t.version = "11.0" | |
37 | t.console = false | |
38 | t.accelerometerjoystick = true | |
39 | t.gammacorrect = false | |
40 | diff --git a/config.lua b/config.lua | |
41 | index 63eeb04..71c2b66 100644 | |
42 | --- a/config.lua | |
43 | +++ b/config.lua | |
44 | @@ -38,7 +38,7 @@ function loadConfig() | |
45 | config[i] = v | |
46 | end | |
47 | end | |
48 | - if love.filesystem.exists("settings") then | |
49 | + if love.filesystem.getInfo("settings")~= nil then | |
50 | local data = love.filesystem.read("settings") | |
51 | local file = TSerial.unpack(data) | |
52 | for i,v in pairs(file) do | |
53 | @@ -52,7 +52,7 @@ function loadConfig() | |
54 | end | |
55 | ||
56 | function loadHighscores() | |
57 | - if love.filesystem.exists("highscores") then | |
58 | + if love.filesystem.getInfo("highscores")~= nil then | |
59 | local data = love.filesystem.read("highscores") | |
60 | local file = TSerial.unpack(data) | |
61 | for i=1,3 do | |
62 | @@ -64,7 +64,7 @@ function loadHighscores() | |
63 | end | |
64 | ||
65 | function loadStats() | |
66 | - if love.filesystem.exists("stats") then | |
67 | + if love.filesystem.getInfo("stats")~= nil then | |
68 | local data = love.filesystem.read("stats") | |
69 | stats = TSerial.unpack(data) | |
70 | end | |
71 | diff --git a/highscore_entry.lua b/highscore_entry.lua | |
72 | index 2f763af..3b3bb73 100644 | |
73 | --- a/highscore_entry.lua | |
74 | +++ b/highscore_entry.lua | |
75 | @@ -45,9 +45,9 @@ function highscore_entry.draw() | |
76 | for ix = 1,10 do | |
77 | if highscore_entry.selection == char then | |
78 | lg.rectangle("fill", 33+ix*16, 66+iy*16, 14, 14) | |
79 | - lg.setColor(0,0,0,255) | |
80 | + lg.setColor(0,0,0,1) | |
81 | lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16) | |
82 | - lg.setColor(255,255,255,255) | |
83 | + lg.setColor(1,1,1,1) | |
84 | else | |
85 | lg.print(KEYBOARD:sub(char,char), 37+ix*16, 70+iy*16) | |
86 | end | |
87 | diff --git a/highscore_list.lua b/highscore_list.lua | |
88 | index 6a17973..b66d0e2 100644 | |
89 | --- a/highscore_list.lua | |
90 | +++ b/highscore_list.lua | |
91 | @@ -31,10 +31,10 @@ function highscore_list.draw() | |
92 | if scores[i] then | |
93 | if highscore_list.level == highscore_list.hllevel | |
94 | and highscore_list.hlpos == i then | |
95 | - lg.setColor(25,118,115,255) | |
96 | + lg.setColor(25/255,118/255,115/255,1) | |
97 | lg.print(scores[i].name, 48, 14+i*16) | |
98 | lg.print(scores[i].score, 105, 14+i*16) | |
99 | - lg.setColor(255,255,255,255) | |
100 | + lg.setColor(1,1,1,1) | |
101 | else | |
102 | lg.print(scores[i].name, 48, 14+i*16) | |
103 | lg.print(scores[i].score, 105, 14+i*16) | |
104 | diff --git a/ingame.lua b/ingame.lua | |
105 | index 52004f1..f5c6f7c 100644 | |
106 | --- a/ingame.lua | |
107 | +++ b/ingame.lua | |
108 | @@ -189,16 +189,16 @@ function ingame.draw() | |
109 | lg.pop() | |
110 | ||
111 | if map.type == MT_NORMAL then | |
112 | - lg.setBlendMode("multiply") | |
113 | + lg.setBlendMode("multiply", "premultiplied") | |
114 | lg.draw(canvas, 0,0) | |
115 | lg.setBlendMode("alpha") | |
116 | end | |
117 | ||
118 | -- Draw red screen if hit | |
119 | if player.heat > 0 then | |
120 | - lg.setColor(255,255,255,cap(player.heat*255, 16, 255)) | |
121 | + lg.setColor(1,1,1,cap(player.heat*255, 16, 255)/255) | |
122 | lg.draw(img.red_screen, quad.red_screen, 0,0) | |
123 | - lg.setColor(255,255,255,255) | |
124 | + lg.setColor(1,1,1,1) | |
125 | end | |
126 | ||
127 | -- Draw hud | |
128 | diff --git a/ingame_menu.lua b/ingame_menu.lua | |
129 | index 9fcf768..82a8459 100644 | |
130 | --- a/ingame_menu.lua | |
131 | +++ b/ingame_menu.lua | |
132 | @@ -18,10 +18,10 @@ function ingame_menu.draw() | |
133 | lg.pop() | |
134 | ||
135 | lg.scale(config.scale) | |
136 | - lg.setColor(0,0,0,238) | |
137 | + lg.setColor(0,0,0,238/255) | |
138 | lg.rectangle("fill", 0, 0, WIDTH, HEIGHT) | |
139 | ||
140 | - lg.setColor(255,255,255,255) | |
141 | + lg.setColor(1,1,1,1) | |
142 | lg.printf("PAUSED", 0, 46, WIDTH, "center") | |
143 | lg.print("RESUME", 103, 92) | |
144 | lg.print("QUIT", 103, 106) | |
145 | diff --git a/joystick.lua b/joystick.lua | |
146 | index 50ccadb..72d545e 100644 | |
147 | --- a/joystick.lua | |
148 | +++ b/joystick.lua | |
149 | @@ -22,11 +22,11 @@ function joystick.draw() | |
150 | lg.printf("SET JOYSTICK", 0, 39, WIDTH, "center") | |
151 | for i=1,4 do | |
152 | if joystick.waiting == true and joystick.selection == i then | |
153 | - lg.setColor(195,52,41) | |
154 | + lg.setColor(195/255,52/255,41/255) | |
155 | end | |
156 | lg.print(string.upper(joykeynames[i]), 65, 53+i*13) | |
157 | lg.print(config.joykeys[joykeynames[i]], 165, 53+i*13) | |
158 | - lg.setColor(255,255,255) | |
159 | + lg.setColor(1,1,1) | |
160 | end | |
161 | lg.print("DEFAULT", 65, 118) | |
162 | lg.print("BACK", 65, 131) | |
163 | diff --git a/main.lua b/main.lua | |
164 | index 9433e42..56096fa 100644 | |
165 | --- a/main.lua | |
166 | +++ b/main.lua | |
167 | @@ -273,7 +273,7 @@ function love.releaseerrhand(msg) | |
168 | local font = love.graphics.newFont(14) | |
169 | love.graphics.setFont(font) | |
170 | ||
171 | - love.graphics.setColor(255, 255, 255, 255) | |
172 | + love.graphics.setColor(1, 1, 1, 1) | |
173 | ||
174 | love.graphics.clear() | |
175 | ||
176 | diff --git a/resources.lua b/resources.lua | |
177 | index e5aa70d..1bab520 100644 | |
178 | --- a/resources.lua | |
179 | +++ b/resources.lua | |
180 | @@ -7,7 +7,7 @@ local snd = {} -- sound Sources | |
181 | ||
182 | local IMAGE_FILES = { | |
183 | "splash", "tangram", "lovesplashpixel", "howto", | |
184 | - "tiles", "door", "boldfont", "captain_dialog", "captain_dialog_sad", | |
185 | + "tiles", "door", "captain_dialog", "captain_dialog_sad", | |
186 | "boss_health", "highscore_panes", "exclamation", "stats_screen", | |
187 | "awards", "hud", "hud2", "hud_people", "item_slots", "water_bar", | |
188 | "reserve_bar", "overloaded_bar", "temperature_bar", "temperature_bar_blink", | |
189 | @@ -147,7 +147,7 @@ function loadResources() | |
190 | img.stream:setWrap("repeat", "clamp") | |
191 | ||
192 | -- Create fonts | |
193 | - font.bold = lg.newImageFont(img.boldfont, " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2) | |
194 | + font.bold = lg.newImageFont("data/boldfont.png", " ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!'-:*@<>+/_$&?", 2) | |
195 | lg.setFont(font.bold) | |
196 | ||
197 | -- Create quads | |
198 | diff --git a/util.lua b/util.lua | |
199 | index b9976da..656600a 100644 | |
200 | --- a/util.lua | |
201 | +++ b/util.lua | |
202 | @@ -105,9 +105,9 @@ end | |
203 | ||
204 | ||
205 | function drawBox(x,y,w,h) | |
206 | - lg.setColor(30,23,18) | |
207 | + lg.setColor(30/255,23/255,18/255) | |
208 | lg.rectangle("fill",x+1,y+1,w-2,h-2) | |
209 | - lg.setColor(255,255,255) | |
210 | + lg.setColor(1,1,1) | |
211 | -- Draw sides | |
212 | lg.draw(img.menu_box, quad.box_left, x, y+1, 0, 1, (h-2)) | |
213 | lg.draw(img.menu_box, quad.box_left, x+w, y+1, 0, -1, (h-2)) |