added some more non-45 degree triangle modes
authorMatthias Braun <matze@braunis.de>
Thu, 25 Nov 2004 16:38:31 +0000 (16:38 +0000)
committerMatthias Braun <matze@braunis.de>
Thu, 25 Nov 2004 16:38:31 +0000 (16:38 +0000)
SVN-Revision: 2193

TODO
data/images/tilesets/supertux.stgt
docs/aatriangletypes.dia [new file with mode: 0644]
docs/aatriangletypes.png [new file with mode: 0644]
lib/math/aatriangle.h
lib/special/collision.cpp
src/badguy/dispenser.cpp
src/player.cpp
src/sector.cpp

diff --git a/TODO b/TODO
index eea9d34..1aa70ed 100644 (file)
--- a/TODO
+++ b/TODO
@@ -75,7 +75,7 @@ L: low priority
     when hitting a block from the side when falling.
       - done for rectangles, fixes the issues with blocks and enemies hitting
         when they should get squished, still it's not optimal as when hitting 2
-        blocks now only 1 gets cleared...
+        blocks now only 1 gets cleared... - ok
  * rethink slopes collision feedback... tux becomes too slow when walking up
     and starts jumping when walking down
  * think about an attachement mechanism for moving platforms
index cf844ee..f340821 100644 (file)
 (supertux-tiles
   (tilegroup
     (name "Snow")
-    (tiles 
-        7 8 9 202 
-        13 14 15 204 
-        10 11 12 206 
-        16 17 18 205 
-        22 21 19 203 
-        23 20 207 208 
-        31 30 114 113 
-        115 116 122 123 
-        117 118 124 125 
-        33 32 34 209 
-        35 37 39 210 
-        38 36 43 0 
-        40 41 42 0 
-        119 121 120 0 
-)
+    (tiles 7 8 9 202 13 14 15 204 10 11 12 206 16 17 18 205 22 21 19 203 23 20 207 208 31 30 114 113 115 116 122 123 117 118 124 125 33 32 34 209 35 37 39 210 38 36 43 0 40 41 42 119 121 120)
   )
-
   (tilegroup
     (name "Forest (Foreground)")
-    (tiles
-        1000 1001 1002 1003 
-        1004 1005 1006 1007 
-        1008 1009 1010 1011 
-        1012 1013 1014 1015 
-        1016 1017 1018 1019 
-        0 1060 1061 0 
-        1063 1064 1065 1066 
-        1067 1068 1069 1070 
-        1045 1046 1051 1052 
-        1047 1048 1053 1054 
-        1049 1050 1055 1056 
-        1042 1043 1057 1058 
-        1034 1035 1029 1030 
-        1041 1040 1031 1032 
-        1036 1037 0 1038 
-        1020 1021 1022 1044 
-        1023 1024 1025 1033 
-        1026 1027 1028 1039 ))
-     
+    (tiles 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 0 1060 1061 1063 1064 1065 1066 1067 1068 1069 1070 1045 1046 1051 1052 1047 1048 1053 1054 1049 1050 1055 1056 1042 1043 1057 1058 1034 1035 1029 1030 1041 1040 1031 1032 1036 1037 1038 1020 1021 1022 1044 1023 1024 1025 1033 1026 1027 1028 1039)
+  )
   (tilegroup
     (name "Forest (Background)")
-    (tiles
-        0 0 1073 1074 
-        0 0 1081 1082 
-        0 1088 1089 1090 
-        1095 1096 1097 1098 
-        1103 1104 1105 1106 
-        1111 1112 1113 1114 
-        1119 1120 1121 1122 
-        1127 1128 1129 1130 
-        0 0 1137 1138 
-        0 0 1145 1146 
-        0 0 1153 1154 
-        0 0 1161 1162 
-        1075 0 0 0 
-        1083 1084 0 0 
-        1091 1092 0 0 
-        1099 1100 1101 0 
-        1107 1108 1109 1110 
-        1115 1116 1117 1118 
-        1123 1124 1125 1126 
-        1131 1132 1133 1134 
-        1139 1140 1141 0 
-        1147 1148 0 0 
-        1155 1156 0 0 
-        1163 1164 0 0 
-        0 1168 1169 1170 
-        0 1174 1175 1176 
-        1179 1180 1181 1182 
-        1185 1186 1187 1188 
-        1191 1192 1193 1194 
-        1197 1198 1199 1200 
-        1191 1192 1193 1194 
-        1197 1198 1199 1200 
-        1203 1204 1205 1206 
-        1209 1210 1211 1212 
-        1177 0 1219 1220 
-        1183 0 1225 1226 
-        1189 1190 1217 1218 
-        1195 0 1223 1224 
-        1201 1190 1229 1230 
-        1195 0 1235 1236 
-        1201 1202 0 0 
-        1207 0 0 0 
-        1213 1214 0 0 
-        0 1240 1241 1242 
-        1243 1244 1245 1246 
-        1247 1248 1249 1250 
-        1251 1252 1253 1254 
-        1255 1256 1257 1258 
-        1259 1260 1261 1262 
-        1263 1264 1265 1266 
-        1267 1268 1269 1270 
-        1271 1272 1273 1274 
-        1275 1276 1277 1278 
-        1279 1280 1281 1282 
-        1283 1284 1285 1286 
-        1287 1288 1303 1304 
-        1289 1290 1305 1306 
-        1291 1292 1307 1308 
-        1293 1294 1309 1310 
-        1295 1296 0 0 
-        1297 1298 0 0 
-        1299 1300 0 0 
-        1301 1302 0 0 
-402
-403
-404
-405
-406
-407
-408
-409
-410
-411
-412
-413
-414
-415
-416
-417
-418
-419
-420
-421
-422
-423
-424
-425
-426
-427
-428
-429
-430
-431
-432
-433
-434
-435
-436
-437
-438
-439
-440
-441
-442
-443
-444
-445
-446
-447
-448
-449
-450
-451
-452
-453
-454
-455
-456
-457
-
-
-))
-
+    (tiles 0 1073 1074 1081 1082 1088 1089 1090 1095 1096 1097 1098 1103 1104 1105 1106 1111 1112 1113 1114 1119 1120 1121 1122 1127 1128 1129 1130 1137 1138 1145 1146 1153 1154 1161 1162 1075 1083 1084 1091 1092 1099 1100 1101 1107 1108 1109 1110 1115 1116 1117 1118 1123 1124 1125 1126 1131 1132 1133 1134 1139 1140 1141 1147 1148 1155 1156 1163 1164 1168 1169 1170 1174 1175 1176 1179 1180 1181 1182 1185 1186 1187 1188 1191 1192 1193 1194 1197 1198 1199 1200 1203 1204 1205 1206 1209 1210 1211 1212 1177 1219 1220 1183 1225 1226 1189 1190 1217 1218 1195 1223 1224 1201 1229 1230 1235 1236 1202 1207 1213 1214 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1303 1304 1289 1290 1305 1306 1291 1292 1307 1308 1293 1294 1309 1310 1295 1296 1297 1298 1299 1300 1301 1302 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457)
+  )
   (tilegroup
     (name "Block")
-    (tiles
-         27 28 29 47 
-        48 50 49 211 
-        77 51 52 212 
-        78 62 61 213 
-        44 83 84 102 140 103 104 105 112 128) 
-    )
+    (tiles 27 28 29 47 48 50 49 211 77 51 52 212 78 62 61 213 44 83 84 102 140 103 104 105 112 128)
+  )
   (tilegroup
     (name "Background")
-    (tiles
-        106 107 108 24 
-        109 110 111 25 
-        85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101)
-    )
+    (tiles 106 107 108 24 109 110 111 25 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101)
+  )
   (tilegroup
     (name "Points")
     (tiles 132 133)
-    )
-  
+  )
   (tilegroup
     (name "Misc")
     (tiles 75 76 200 201 79 80 126 127 129 130 134 135 81 295 296 297 298 173 174)
   )
   (tilegroup
     (name "Pipe")
-    (tiles 53 55 0 0 
-        54 56 0 0 
-        57 58 0 0 
-        59 60 0 0 )
+    (tiles 53 55 0 54 56 57 58 59 60)
   )
   (tilegroup
     (name "Grey")
   )
   (tilegroup
     (name "Signs")
-    (tiles         136 137 141 142 
-        138 139 143 144 )
+    (tiles 136 137 141 142 138 139 143 144)
   )
   (tilegroup
     (name "Grasslands")
   )
   (tilegroup
     (name "Jungle")
-    (tiles         301 302 303 312 
-        304 305 306 0 
-        307 308 309 0 
-        310 311 0 0 )
+    (tiles 301 302 303 312 304 305 306 0 307 308 309 310 311)
   )
   (tilegroup
     (name "Slopes")
   (tilegroup
     (name "Waterfall-edgecloud")
     (tiles 195 196 197 198 199)
-    )
+  )
   (tile
     (id 0)
     (editor-images "bonus-fireflower.png")
     )
     (slope-type 0)
   )
-
-(tile
+  (tile
     (id 402)
     (images
-      (region "foresttiles-12.png"  0 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 0 32 32)
+    )
+  )
+  (tile
     (id 403)
     (images
-      (region "foresttiles-12.png"  32 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 0 32 32)
+    )
+  )
+  (tile
     (id 404)
     (images
-      (region "foresttiles-12.png"  64 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 0 32 32)
+    )
+  )
+  (tile
     (id 405)
     (images
-      (region "foresttiles-12.png"  96 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 96 0 32 32)
+    )
+  )
+  (tile
     (id 406)
     (images
-      (region "foresttiles-12.png"  0 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 32 32 32)
+    )
+  )
+  (tile
     (id 407)
     (images
-      (region "foresttiles-12.png"  32 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 32 32 32)
+    )
+  )
+  (tile
     (id 408)
     (images
-      (region "foresttiles-12.png"  64 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 32 32 32)
+    )
+  )
+  (tile
     (id 409)
     (images
-      (region "foresttiles-12.png"  96 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 96 32 32 32)
+    )
+  )
+  (tile
     (id 410)
     (images
-      (region "foresttiles-12.png"  0 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 64 32 32)
+    )
+  )
+  (tile
     (id 411)
     (images
-      (region "foresttiles-12.png"  32 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 64 32 32)
+    )
+  )
+  (tile
     (id 412)
     (images
-      (region "foresttiles-12.png"  64 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 64 32 32)
+    )
+  )
+  (tile
     (id 413)
     (images
-      (region "foresttiles-12.png"  96 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 96 64 32 32)
+    )
+  )
+  (tile
     (id 414)
     (images
-      (region "foresttiles-12.png"  0 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 96 32 32)
+    )
+  )
+  (tile
     (id 415)
     (images
-      (region "foresttiles-12.png"  32 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 96 32 32)
+    )
+  )
+  (tile
     (id 416)
     (images
-      (region "foresttiles-12.png"  64 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 96 32 32)
+    )
+  )
+  (tile
     (id 417)
     (images
-      (region "foresttiles-12.png"  96 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 96 96 32 32)
+    )
+  )
+  (tile
     (id 418)
     (images
-      (region "foresttiles-12.png"  0 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 128 32 32)
+    )
+  )
+  (tile
     (id 419)
     (images
-      (region "foresttiles-12.png"  32 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 128 32 32)
+    )
+  )
+  (tile
     (id 420)
     (images
-      (region "foresttiles-12.png"  64 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 128 32 32)
+    )
+  )
+  (tile
     (id 421)
     (images
-      (region "foresttiles-12.png"  96 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 96 128 32 32)
+    )
+  )
+  (tile
     (id 422)
     (images
-      (region "foresttiles-12.png"  0 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 0 160 32 32)
+    )
+  )
+  (tile
     (id 423)
     (images
-      (region "foresttiles-12.png"  32 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 32 160 32 32)
+    )
+  )
+  (tile
     (id 424)
     (images
-      (region "foresttiles-12.png"  64 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 64 160 32 32)
+    )
+  )
+  (tile
     (id 425)
     (images
-      (region "foresttiles-12.png"  96 160 32 32)))
-
-(tile
+      (region "foresttiles-12.png" 96 160 32 32)
+    )
+  )
+  (tile
     (id 426)
     (images
-      (region "foresttiles-12.png"  128 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 0 32 32)
+    )
+  )
+  (tile
     (id 427)
     (images
-      (region "foresttiles-12.png"  160 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 0 32 32)
+    )
+  )
+  (tile
     (id 428)
     (images
-      (region "foresttiles-12.png"  192 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 0 32 32)
+    )
+  )
+  (tile
     (id 429)
     (images
-      (region "foresttiles-12.png"  224 0 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 0 32 32)
+    )
+  )
+  (tile
     (id 430)
     (images
-      (region "foresttiles-12.png"  128 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 32 32 32)
+    )
+  )
+  (tile
     (id 431)
     (images
-      (region "foresttiles-12.png"  160 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 32 32 32)
+    )
+  )
+  (tile
     (id 432)
     (images
-      (region "foresttiles-12.png"  192 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 32 32 32)
+    )
+  )
+  (tile
     (id 433)
     (images
-      (region "foresttiles-12.png"  224 32 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 32 32 32)
+    )
+  )
+  (tile
     (id 434)
     (images
-      (region "foresttiles-12.png"  128 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 64 32 32)
+    )
+  )
+  (tile
     (id 435)
     (images
-      (region "foresttiles-12.png"  160 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 64 32 32)
+    )
+  )
+  (tile
     (id 436)
     (images
-      (region "foresttiles-12.png"  192 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 64 32 32)
+    )
+  )
+  (tile
     (id 437)
     (images
-      (region "foresttiles-12.png"  224 64 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 64 32 32)
+    )
+  )
+  (tile
     (id 438)
     (images
-      (region "foresttiles-12.png"  128 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 96 32 32)
+    )
+  )
+  (tile
     (id 439)
     (images
-      (region "foresttiles-12.png"  160 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 96 32 32)
+    )
+  )
+  (tile
     (id 440)
     (images
-      (region "foresttiles-12.png"  192 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 96 32 32)
+    )
+  )
+  (tile
     (id 441)
     (images
-      (region "foresttiles-12.png"  224 96 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 96 32 32)
+    )
+  )
+  (tile
     (id 442)
     (images
-      (region "foresttiles-12.png"  128 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 128 32 32)
+    )
+  )
+  (tile
     (id 443)
     (images
-      (region "foresttiles-12.png"  160 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 128 32 32)
+    )
+  )
+  (tile
     (id 444)
     (images
-      (region "foresttiles-12.png"  192 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 128 32 32)
+    )
+  )
+  (tile
     (id 445)
     (images
-      (region "foresttiles-12.png"  224 128 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 128 32 32)
+    )
+  )
+  (tile
     (id 446)
     (images
-      (region "foresttiles-12.png"  128 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 160 32 32)
+    )
+  )
+  (tile
     (id 447)
     (images
-      (region "foresttiles-12.png"  160 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 160 32 32)
+    )
+  )
+  (tile
     (id 448)
     (images
-      (region "foresttiles-12.png"  192 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 160 32 32)
+    )
+  )
+  (tile
     (id 449)
     (images
-      (region "foresttiles-12.png"  224 160 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 160 32 32)
+    )
+  )
+  (tile
     (id 450)
     (images
-      (region "foresttiles-12.png"  128 192 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 192 32 32)
+    )
+  )
+  (tile
     (id 451)
     (images
-      (region "foresttiles-12.png"  160 192 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 192 32 32)
+    )
+  )
+  (tile
     (id 452)
     (images
-      (region "foresttiles-12.png"  192 192 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 192 32 32)
+    )
+  )
+  (tile
     (id 453)
     (images
-      (region "foresttiles-12.png"  224 192 32 32)))
-(tile
+      (region "foresttiles-12.png" 224 192 32 32)
+    )
+  )
+  (tile
     (id 454)
     (images
-      (region "foresttiles-12.png"  128 224 32 32)))
-(tile
+      (region "foresttiles-12.png" 128 224 32 32)
+    )
+  )
+  (tile
     (id 455)
     (images
-      (region "foresttiles-12.png"  160 224 32 32)))
-(tile
+      (region "foresttiles-12.png" 160 224 32 32)
+    )
+  )
+  (tile
     (id 456)
     (images
-      (region "foresttiles-12.png"  192 224 32 32)))
-(tile
+      (region "foresttiles-12.png" 192 224 32 32)
+    )
+  )
+  (tile
     (id 457)
     (images
-      (region "foresttiles-12.png"  224 224 32 32)))
-
+      (region "foresttiles-12.png" 224 224 32 32)
+    )
+  )
   (tile
     (id 1000)
     (images
     (images
       (region "foresttiles-6.png" 0 32 32 32)
     )
-    (slope-type 0)
+    (slope-type 66)
+    (data 66)
   )
   (tile
     (id 1054)
     (images
       (region "foresttiles-6.png" 32 32 32 32)
     )
-    (slope-type 0)
+    (slope-type 48)
+    (data 48)
   )
   (tile
     (id 1055)
       (region "foresttiles-6.png" 0 64 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 50)
+    (data 50)
   )
   (tile
     (id 1056)
       (region "foresttiles-6.png" 32 64 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 64)
+    (data 64)
   )
   (tile
     (id 1057)
     (images
       (region "foresttiles-7.png" 32 0 32 32)
     )
-    (slope-type 0)
   )
   (tile
     (id 1061)
     (images
       (region "foresttiles-7.png" 64 0 32 32)
     )
-    (slope-type 0)
   )
   (tile
     (id 1063)
       (region "foresttiles-7.png" 0 32 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 18)
+    (data 18)
   )
   (tile
     (id 1064)
       (region "foresttiles-7.png" 32 32 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 34)
+    (data 34)
   )
   (tile
     (id 1065)
       (region "foresttiles-7.png" 64 32 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 32)
+    (data 32)
   )
   (tile
     (id 1066)
       (region "foresttiles-7.png" 96 32 32 32)
     )
     (solid #t)
-    (slope-type 0)
+    (slope-type 16)
+    (data 16)
   )
   (tile
     (id 1067)
diff --git a/docs/aatriangletypes.dia b/docs/aatriangletypes.dia
new file mode 100644 (file)
index 0000000..d07d18d
Binary files /dev/null and b/docs/aatriangletypes.dia differ
diff --git a/docs/aatriangletypes.png b/docs/aatriangletypes.png
new file mode 100644 (file)
index 0000000..c5e5091
Binary files /dev/null and b/docs/aatriangletypes.png differ
index 8760938..97cbae8 100644 (file)
@@ -20,21 +20,32 @@ public:
    *    | \             \  |         / |       |  /
    *    |  \             \ |        /  |       | /
    *    *---*              *       *---*       *
+   *
+   * Deform flags: (see docs/aatriangletypes.png for details)
    */
   enum Direction {
-    SOUTHWEST, NORTHEAST, SOUTHEAST, NORTHWEST
+    SOUTHWEST = 0,
+    NORTHEAST,
+    SOUTHEAST,
+    NORTHWEST,
+    DIRECTION_MASK = 0x0003,
+    DEFORM1 = 0x0010,
+    DEFORM2 = 0x0020,
+    DEFORM3 = 0x0030,
+    DEFORM4 = 0x0040,
+    DEFORM_MASK = 0x0070
   };
 
   AATriangle()
     : dir(SOUTHWEST)
   {
   }
-  AATriangle(const Vector& v1, const Vector& v2, Direction newdir)
+  AATriangle(const Vector& v1, const Vector& v2, int newdir)
     : Rectangle(v1, v2), dir(newdir)
   {
   }
 
-  Direction dir;
+  int dir;
 };
 
 }
index d391ce5..b192dc3 100644 (file)
@@ -83,29 +83,57 @@ Collision::rectangle_aatriangle(CollisionHit& hit, const Rectangle& rect,
 {
   if(!rectangle_rectangle(hit, rect, movement, (const Rectangle&) triangle))
     return false;
-  
+
   Vector normal;
   float c;
   Vector p1;
-  switch(triangle.dir) {
+  Vector tp1, tp2;
+  switch(triangle.dir & AATriangle::DEFORM_MASK) {
+    case 0:
+      tp1 = triangle.p1;
+      tp2 = triangle.p2;
+      break;
+    case AATriangle::DEFORM1:
+      tp1 = Vector(triangle.p1.x, triangle.p1.y + triangle.get_height()/2);
+      tp2 = triangle.p2;
+      break;
+    case AATriangle::DEFORM2:
+      tp1 = triangle.p1;
+      tp2 = Vector(triangle.p2.x, triangle.p1.y + triangle.get_height()/2);
+      break;
+    case AATriangle::DEFORM3:
+      tp1 = triangle.p1;
+      tp2 = Vector(triangle.p1.x + triangle.get_width()/2, triangle.p2.y);
+      break;
+    case AATriangle::DEFORM4:
+      tp1 = Vector(triangle.p1.x + triangle.get_width()/2, triangle.p1.y);
+      tp2 = triangle.p2;
+      break;
+    default:
+      assert(false);
+  } 
+  
+  switch(triangle.dir & AATriangle::DIRECTION_MASK) {
     case AATriangle::SOUTHWEST:
       p1 = Vector(rect.p1.x, rect.p2.y);
-      makePlane(triangle.p1, triangle.p2, normal, c);
+      makePlane(tp1, tp2, normal, c);
       break;
     case AATriangle::NORTHEAST:
       p1 = Vector(rect.p2.x, rect.p1.y);
-      makePlane(triangle.p2, triangle.p1, normal, c);
+      makePlane(tp2, tp1, normal, c);
       break;
     case AATriangle::SOUTHEAST:
       p1 = rect.p2;
-      makePlane(Vector(triangle.p1.x, triangle.p2.y),
-          Vector(triangle.p2.x, triangle.p1.y), normal, c);
+      makePlane(Vector(tp1.x, tp2.y),
+          Vector(tp2.x, tp1.y), normal, c);
       break;
     case AATriangle::NORTHWEST:
       p1 = rect.p1;
-      makePlane(Vector(triangle.p2.x, triangle.p1.y),
-          Vector(triangle.p1.x, triangle.p2.y), normal, c);
+      makePlane(Vector(tp2.x, tp1.y),
+          Vector(tp1.x, tp2.y), normal, c);
       break;
+    default:
+      assert(false);
   }
 
   float n_p1 = -(normal * p1);
index c2ba901..b88ec20 100644 (file)
@@ -51,9 +51,9 @@ Dispenser::collision_squished(Player& player)
 void
 Dispenser::active_action(float )
 {
-   if (dispense_timer.check()) {
-      launch_badguy();
-   }
+  if (dispense_timer.check()) {
+    launch_badguy();
+  }
 }
 
 HitResponse
@@ -78,8 +78,8 @@ Dispenser::collision_solid(GameObject& , const CollisionHit& hit)
 void
 Dispenser::launch_badguy()
 {
-   //FIXME: Does is_offscreen() work right here?
-   if (!is_offscreen()) {
+  //FIXME: Does is_offscreen() work right here?
+  if (!is_offscreen()) {
     if (badguy == "snowball")
       Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y, dir));
     else if (badguy == "bouncingsnowball")
@@ -89,6 +89,7 @@ Dispenser::launch_badguy()
     else if (badguy == "mriceblock")
       Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y, dir));
     else if (badguy == "random")
-      {}
-   }
+    {}
+  }
 }
+
index cf945e4..3f5bb93 100644 (file)
@@ -857,10 +857,6 @@ Player::draw(DrawingContext& context)
 HitResponse
 Player::collision(GameObject& other, const CollisionHit& hit)
 {
-  if(dying) {
-    return FORCE_MOVE;
-  }
-
   if(other.get_flags() & FLAG_SOLID) {
     if(hit.normal.y < 0) { // landed on floor?
       if (physic.get_velocity_y() < 0)
index f5609fd..e98ac97 100644 (file)
@@ -673,23 +673,7 @@ Sector::collision_tilemap(MovingObject* object, int depth)
         AATriangle triangle;
         Vector p1(x*32, y*32);
         Vector p2((x+1)*32, (y+1)*32);
-        switch(tile->data) {
-          case 0:
-            triangle = AATriangle(p1, p2, AATriangle::SOUTHWEST);
-            break;
-          case 1:
-            triangle = AATriangle(p1, p2, AATriangle::NORTHEAST);
-            break;
-          case 2:
-            triangle = AATriangle(p1, p2, AATriangle::SOUTHEAST);
-            break;
-          case 3:
-            triangle = AATriangle(p1, p2, AATriangle::NORTHWEST);
-            break;
-          default:
-            printf("Invalid slope angle in tile %d !\n", tile->id);
-            break;
-        }
+        triangle = AATriangle(p1, p2, tile->data);
 
         if(Collision::rectangle_aatriangle(temphit, dest, object->movement,
               triangle)) {