337 -- so I herd u liek wariables |
337 -- so I herd u liek wariables |
338 ---------------------------------- |
338 ---------------------------------- |
339 |
339 |
340 local fMod = 1000000 -- use this for dev and .16+ games |
340 local fMod = 1000000 -- use this for dev and .16+ games |
341 |
341 |
|
342 -- Tag IDs |
|
343 local TAG_TIME = 0 |
|
344 local TAG_BARRELS = 1 |
|
345 local TAG_SHIELD = 2 |
|
346 local TAG_ROUND_SCORE = 4 |
|
347 |
342 -- some console stuff |
348 -- some console stuff |
343 local shellID = 0 |
349 local shellID = 0 |
344 local explosivesID = 0 |
350 local explosivesID = 0 |
345 local luaGameTicks = 0 |
351 local luaGameTicks = 0 |
346 |
352 |
523 -- some lazy copypasta/modified methods |
529 -- some lazy copypasta/modified methods |
524 ------------------------------------------- |
530 ------------------------------------------- |
525 |
531 |
526 |
532 |
527 |
533 |
528 function HideTags() |
534 function HideTag(i) |
529 |
535 |
530 for i = 0, 4 do |
536 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
531 SetVisualGearValues(vTag[i],0,0,0,0,0,1,0, 0, 240000, 0xffffff00) |
|
532 end |
|
533 |
537 |
534 end |
538 end |
535 |
539 |
536 function DrawTag(i) |
540 function DrawTag(i) |
537 |
541 |
538 local zoomL = 1.3 |
542 local zoomL = 1.3 |
539 local xOffset = 40 |
543 local xOffset = 40 |
540 local yOffset, tValue, tCol |
544 local yOffset, tValue, tCol |
541 |
545 |
542 if i == 0 then |
546 if i == TAG_TIME then |
543 yOffset = 40 |
547 yOffset = 40 |
544 tCol = 0xffee00ff |
548 tCol = 0xffee00ff |
545 tValue = TimeLeft |
549 tValue = TimeLeft |
546 elseif i == 1 then |
550 elseif i == TAG_BARRELS then |
547 zoomL = 1.1 |
551 zoomL = 1.1 |
548 yOffset = 70 |
552 yOffset = 70 |
549 tCol = 0x00ff00ff |
553 tCol = 0x00ff00ff |
550 tValue = wepAmmo[wepIndex] --primShotsLeft |
554 tValue = wepAmmo[wepIndex] --primShotsLeft |
551 elseif i == 2 then |
555 elseif i == TAG_SHIELD then |
552 zoomL = 1.1 |
556 zoomL = 1.1 |
553 xOffset = 40 + 35 |
557 xOffset = 40 + 35 |
554 yOffset = 70 |
558 yOffset = 70 |
555 tCol = 0xa800ffff |
559 tCol = 0xa800ffff |
556 tValue = shieldHealth - 80 |
560 tValue = shieldHealth - 80 |
557 elseif i == 4 then |
561 elseif i == TAG_ROUND_SCORE then |
558 zoomL = 1.1 |
562 zoomL = 1.1 |
559 xOffset = 40 + 80 |
563 xOffset = 40 |
560 yOffset = 70 |
564 yOffset = 100 |
561 tCol = 0xffffffff |
565 tCol = 0xffffffff |
562 tValue = roundScore |
566 tValue = roundScore |
563 end |
567 end |
564 |
568 |
565 DeleteVisualGear(vTag[i]) |
569 DeleteVisualGear(vTag[i]) |
566 vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
570 vTag[i] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
567 SetVisualGearValues ( |
571 SetVisualGearValues ( |
568 vTag[i], --id |
572 vTag[i], --id |
569 -(ScreenWidth/2) + xOffset, --xoffset |
573 -(div(ScreenWidth, 2)) + xOffset, --xoffset |
570 ScreenHeight - yOffset, --yoffset |
574 ScreenHeight - yOffset, --yoffset |
571 0, --dx |
575 0, --dx |
572 0, --dy |
576 0, --dy |
573 zoomL, --zoom |
577 zoomL, --zoom |
574 1, --~= 0 means align to screen |
578 1, --~= 0 means align to screen |
643 end |
647 end |
644 |
648 |
645 -- control |
649 -- control |
646 function AwardPoints(p) |
650 function AwardPoints(p) |
647 roundScore = roundScore + p |
651 roundScore = roundScore + p |
648 DrawTag(4) |
652 DrawTag(TAG_ROUND_SCORE) |
649 |
653 |
650 for i = 0,(TeamsCount-1) do |
654 for i = 0,(TeamsCount-1) do |
651 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
655 if teamClan[i] == GetHogClan(CurrentHedgehog) then |
652 teamScore[i] = teamScore[i] + p |
656 teamScore[i] = teamScore[i] + p |
653 SetTeamLabel(teamNameArr[i], teamScore[i]) |
657 SetTeamLabel(teamNameArr[i], teamScore[i]) |
1064 PlaySound(sndSuddenDeath) |
1068 PlaySound(sndSuddenDeath) |
1065 AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage) |
1069 AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage) |
1066 else |
1070 else |
1067 PlaySound(sndThrowRelease) |
1071 PlaySound(sndThrowRelease) |
1068 end |
1072 end |
1069 DrawTag(1) |
1073 DrawTag(TAG_BARRELS) |
1070 |
1074 |
1071 elseif wep[wepIndex] == loc("Mine Deployer") then |
1075 elseif wep[wepIndex] == loc("Mine Deployer") then |
1072 local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0) |
1076 local morte = AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtAirBomb, 0, 0, 0, 0) |
1073 SetTimer(morte, 1000) |
1077 SetTimer(morte, 1000) |
1074 DrawTag(1) |
1078 DrawTag(TAG_BARRELS) |
1075 end |
1079 end |
1076 |
1080 |
1077 elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
1081 elseif (wepAmmo[wepIndex] == 0) and (CurrentHedgehog ~= nil) and (stopMovement == false) and (tumbleStarted == true) then |
1078 PlaySound(sndDenied) |
1082 PlaySound(sndDenied) |
1079 AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage) |
1083 AddCaption(loc("Ammo depleted!"),0xff0000ff,capgrpMessage) |
1229 |
1233 |
1230 for i = 0, 4 do |
1234 for i = 0, 4 do |
1231 vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
1235 vTag[0] = AddVisualGear(0, 0, vgtHealthTag, 0, false) |
1232 end |
1236 end |
1233 |
1237 |
1234 HideTags() |
1238 HideTag(TAG_TIME) |
|
1239 HideTag(TAG_BARRELS) |
|
1240 HideTag(TAG_SHIELD) |
|
1241 HideTag(TAG_ROUND_SCORE) |
1235 |
1242 |
1236 wep[0] = loc("Barrel Launcher") |
1243 wep[0] = loc("Barrel Launcher") |
1237 wep[1] = loc("Mine Deployer") |
1244 wep[1] = loc("Mine Deployer") |
1238 wep[2] = loc("Flamer") |
1245 wep[2] = loc("Flamer") |
1239 |
1246 |
1282 end |
1289 end |
1283 |
1290 |
1284 function onScreenResize() |
1291 function onScreenResize() |
1285 |
1292 |
1286 -- redraw Tags so that their screen locations are updated |
1293 -- redraw Tags so that their screen locations are updated |
1287 if (CurrentHedgehog ~= nil) and (tumbleStarted == true) then |
1294 if (gameBegun == true) then |
1288 DrawTag(0) |
1295 DrawTag(TAG_ROUND_SCORE) |
1289 DrawTag(1) |
1296 if (stopMovement == false) then |
1290 DrawTag(2) |
1297 DrawTag(TAG_BARRELS) |
1291 DrawTag(4) |
1298 DrawTag(TAG_SHIELD) |
|
1299 if (tumbleStarted == true) then |
|
1300 DrawTag(TAG_TIME) |
|
1301 end |
|
1302 end |
1292 end |
1303 end |
1293 |
1304 |
1294 end |
1305 end |
1295 |
1306 |
1296 function onNewTurn() |
1307 function onNewTurn() |
1350 wepAmmo[2] = 5000 |
1361 wepAmmo[2] = 5000 |
1351 wepIndex = 2 |
1362 wepIndex = 2 |
1352 ChangeWeapon() |
1363 ChangeWeapon() |
1353 |
1364 |
1354 |
1365 |
1355 HideTags() |
1366 HideTag(TAG_TIME) |
|
1367 if not gameOver then |
|
1368 DrawTag(TAG_BARRELS) |
|
1369 DrawTag(TAG_SHIELD) |
|
1370 DrawTag(TAG_ROUND_SCORE) |
|
1371 else |
|
1372 HideTag(TAG_BARRELS) |
|
1373 HideTag(TAG_SHIELD) |
|
1374 HideTag(TAG_ROUND_SCORE) |
|
1375 end |
1356 |
1376 |
1357 --------------- |
1377 --------------- |
1358 --------------- |
1378 --------------- |
1359 --AddCaption("num g: " .. numGears() ) |
1379 --AddCaption("num g: " .. numGears() ) |
1360 --WriteLnToConsole("onNewTurn, I just set a bunch of variables to their necessary states. This was done at:") |
1380 --WriteLnToConsole("onNewTurn, I just set a bunch of variables to their necessary states. This was done at:") |
1447 tumbleStarted = true |
1467 tumbleStarted = true |
1448 TimeLeft = (TurnTime/1000) |
1468 TimeLeft = (TurnTime/1000) |
1449 fadeAlpha = 0 |
1469 fadeAlpha = 0 |
1450 rAlpha = 255 |
1470 rAlpha = 255 |
1451 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1471 AddGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), gtGrenade, 0, 0, 0, 1) |
1452 DrawTag(0) |
1472 DrawTag(TAG_TIME) |
1453 DrawTag(1) |
1473 DrawTag(TAG_BARRELS) |
1454 DrawTag(2) |
1474 DrawTag(TAG_SHIELD) |
1455 DrawTag(4) |
1475 DrawTag(TAG_ROUND_SCORE) |
1456 SetMyCircles(true) |
1476 SetMyCircles(true) |
1457 end |
1477 end |
1458 end |
1478 end |
1459 |
1479 |
1460 --WriteLnToConsole("Finished initial check") |
1480 --WriteLnToConsole("Finished initial check") |
1539 } |
1559 } |
1540 end |
1560 end |
1541 |
1561 |
1542 end |
1562 end |
1543 |
1563 |
1544 AddCaption(loc(string.format(loc("Round score: %d"), roundScore)), 0xFFFFFFFF, capgrpMessage2) |
|
1545 |
|
1546 -- other awards |
1564 -- other awards |
1547 awardRoundScore = UpdateSimpleAward(awardRoundScore, roundScore, 50) |
1565 awardRoundScore = UpdateSimpleAward(awardRoundScore, roundScore, 50) |
1548 awardRoundKills = UpdateSimpleAward(awardRoundKills, roundKills, 5) |
1566 awardRoundKills = UpdateSimpleAward(awardRoundKills, roundKills, 5) |
1549 |
1567 |
1550 HideTags() |
1568 HideTag(TAG_TIME) |
|
1569 HideTag(TAG_BARRELS) |
|
1570 HideTag(TAG_SHIELD) |
1551 |
1571 |
1552 end |
1572 end |
1553 else -- remove this if you want tumbler to fall slowly on death |
1573 else -- remove this if you want tumbler to fall slowly on death |
1554 ------------------------------- |
1574 ------------------------------- |
1555 -- Player is still in luck |
1575 -- Player is still in luck |
1877 |
1897 |
1878 if (vType[i] == "drone") then |
1898 if (vType[i] == "drone") then |
1879 PlaySound(sndHellishImpact4) |
1899 PlaySound(sndHellishImpact4) |
1880 TimeLeft = TimeLeft + timeBonus |
1900 TimeLeft = TimeLeft + timeBonus |
1881 AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage ) |
1901 AddCaption(string.format(loc("Time extended! +%dsec"), timeBonus), 0xff0000ff,capgrpMessage ) |
1882 DrawTag(0) |
1902 DrawTag(TAG_TIME) |
1883 |
1903 |
1884 local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
1904 local morte = AddGear(vCircX[i], vCircY[i], gtExplosives, 0, 0, 0, 1) |
1885 SetHealth(morte, 0) |
1905 SetHealth(morte, 0) |
1886 |
1906 |
1887 RK = RK + 1 |
1907 RK = RK + 1 |
1895 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
1915 AddVisualGear(vCircX[i], vCircY[i], vgtExplosion, 0, false) |
1896 PlaySound(sndExplosion) |
1916 PlaySound(sndExplosion) |
1897 PlaySound(sndShotgunReload) |
1917 PlaySound(sndShotgunReload) |
1898 wepAmmo[0] = wepAmmo[0] + barrelBonus |
1918 wepAmmo[0] = wepAmmo[0] + barrelBonus |
1899 AddCaption(string.format(loc("+%d Ammo"), barrelBonus), 0x00ff00ff,capgrpMessage) |
1919 AddCaption(string.format(loc("+%d Ammo"), barrelBonus), 0x00ff00ff,capgrpMessage) |
1900 DrawTag(1) |
1920 DrawTag(TAG_BARRELS) |
1901 |
1921 |
1902 GK = GK + 1 |
1922 GK = GK + 1 |
1903 if GK == 3 then |
1923 if GK == 3 then |
1904 GK = 0 |
1924 GK = 0 |
1905 AddCaption(loc("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2) |
1925 AddCaption(loc("Ammo Maniac! +5 points!"),0xffba00ff,capgrpMessage2) |
1924 AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage) |
1944 AddCaption(string.format(loc("Shield boosted! +%d power"),shieldBonus), 0xa800ffff,capgrpMessage) |
1925 if shieldHealth >= 250 then |
1945 if shieldHealth >= 250 then |
1926 shieldHealth = 250 |
1946 shieldHealth = 250 |
1927 AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage) |
1947 AddCaption(loc("Shield is fully recharged!"),0xa800ffff,capgrpMessage) |
1928 end |
1948 end |
1929 DrawTag(2) |
1949 DrawTag(TAG_SHIELD) |
1930 |
1950 |
1931 OK = OK + 1 |
1951 OK = OK + 1 |
1932 if OK == 3 then |
1952 if OK == 3 then |
1933 OK = 0 |
1953 OK = 0 |
1934 AddCaption(loc("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2) |
1954 AddCaption(loc("Shield Seeker! +10 points!"),0xffba00ff,capgrpMessage2) |
2488 |
2508 |
2489 |
2509 |
2490 if (CurrentHedgehog ~= nil) then |
2510 if (CurrentHedgehog ~= nil) then |
2491 if beam == true then |
2511 if beam == true then |
2492 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, 0xa800ffff-0x000000ff - -shieldHealth ) |
2512 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 200, nil, 0xa800ffff-0x000000ff - -shieldHealth ) |
2493 DrawTag(2) |
2513 DrawTag(TAG_SHIELD) |
2494 else |
2514 else |
2495 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0) |
2515 SetVisualGearValues(pShield, GetX(CurrentHedgehog), GetY(CurrentHedgehog), nil, nil, nil, nil, nil, 0) |
2496 end |
2516 end |
2497 |
2517 |
2498 if shockwaveHealth > 0 then |
2518 if shockwaveHealth > 0 then |