etaynehud.zsc (4210B)
1 class DevilbunnyHUD : BaseStatusBar 2 { 3 HUDFont testfont; 4 5 override void Init() 6 { 7 testfont = HUDFont.Create(smallfont); 8 9 PlayerInfo p = players[consoleplayer]; 10 if (p && p.mo) 11 { 12 AttachToPlayer(p); 13 BeginHUD(); 14 BeginStatusBar(); 15 } 16 } 17 18 override void Tick() //every 1/35s 19 { 20 super.Tick(); 21 } 22 23 override void Draw(int state, double TicFrac) //every frame 24 { 25 if (state == HUD_StatusBar) 26 { 27 DrawSBar(); 28 } 29 else if (state == HUD_Fullscreen) 30 { 31 DrawFullScreenHUD(); 32 } 33 super.Draw(state, TicFrac); 34 } 35 36 void DrawSBar() 37 { 38 39 } 40 41 void DrawFullScreenHud() 42 { 43 let p = PlayerPawn(players[consoleplayer].mo); 44 let bun = DevilbunnyPlayer(players[consoleplayer].mo); 45 46 if (bun) 47 { 48 DrawHealthAndSpirit(); 49 50 //mugshot 51 DrawImage("MSHOT", (170, 190), 0); 52 53 //sword 54 if (bun.hasSword) 55 { 56 DrawImage("HUDSWD", (40, 190), 0); 57 } 58 59 DrawKeyIcons(); 60 DrawWeaponIcons(); 61 } 62 } 63 64 void DrawHealthAndSpirit() 65 { 66 int hpxpos, spirxpos, ypos; 67 68 hpxpos = 10; 69 spirxpos = 70; 70 ypos = 190; 71 72 let bun = DevilbunnyPlayer(players[consoleplayer].mo); 73 74 if(bun.hitpoints > 0) 75 { 76 DrawImage("HCONT", (hpxpos, ypos), 0); 77 } 78 else 79 { 80 DrawImage("HCDEATH", (hpxpos, ypos), 0); 81 } 82 DrawBar("HLTHFUL", "HMPTY", bun.hitpoints, bun.maxhits, (hpxpos,ypos), 0, 3, 0); 83 84 DrawImage("SCONT", (spirxpos, ypos), 0); 85 DrawBar("SPIRLOS", "HMPTY", bun.spirit, bun.maxspirit, (spirxpos, ypos), 0, 3, 0); 86 DrawBar("SPIRFUL", "HMPTY", bun.targspirit, bun.maxspirit, (spirxpos, ypos), 0, 3, 0); 87 } 88 89 void DrawKeyIcons() 90 { 91 if(CheckInventory("BlueCard") || CheckInventory("BlueSkull")) 92 { 93 DrawImage("KEYBLU", (100, 190), 0); 94 } 95 if(CheckInventory("YellowCard") || CheckInventory("YellowSkull")) 96 { 97 DrawImage("KEYYEL", (110, 190), 0); 98 } 99 if(CheckInventory("RedCard") || CheckInventory("RedSkull")) 100 { 101 DrawImage("KEYRED", (120, 190), 0); 102 } 103 104 } 105 106 void DrawWeaponIcons() 107 { 108 let bun = DevilbunnyPlayer(players[consoleplayer].mo); 109 110 int S1xpos, S2xpos, S3xpos, S4xpos, S5xpos, S6xpos; 111 int ypos; 112 113 s1xpos = 220; 114 s2xpos = 250; 115 s3xpos = 280; 116 s4xpos = 310; 117 s5xpos = 340; 118 s6xpos = 370; 119 120 ypos = 190; 121 122 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("CorpsACorps"))) 123 { 124 DrawImage("SLOT1ICO", (s1xpos, ypos), 0); 125 } 126 else 127 { 128 DrawImage("S1INACT", (s1xpos, ypos), 0); 129 } 130 131 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("Pflug"))) 132 { 133 DrawImage("SLOT2ICO", (s2xpos, ypos), 0); 134 } 135 else 136 { 137 if(bun.hasSword) 138 { 139 DrawImage("S2INACT", (s2xpos, ypos), 0); 140 } 141 else 142 { 143 DrawImage("S2UNA", (s2xpos, ypos), 0); 144 } 145 } 146 147 if(CheckInventory("Fleche")) 148 { 149 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("Fleche"))) 150 { 151 DrawImage("SLOT3ICO", (s3xpos, ypos), 0); 152 } 153 else 154 { 155 if (bun.hasSword) 156 { 157 DrawImage("S3INACT", (s3xpos, ypos), 0); 158 } 159 else 160 { 161 DrawImage("S3UNA", (s3xpos, ypos), 0); 162 } 163 } 164 } 165 166 if(CheckInventory("ThrowTech")) 167 { 168 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("ThrowTech"))) 169 { 170 DrawImage("SLOT4ICO", (s4xpos, ypos), 0); 171 } 172 else 173 { 174 if (bun.hasSword) 175 { 176 DrawImage("S4INACT", (s4xpos, ypos), 0); 177 } 178 else 179 { 180 DrawImage("S4UNA", (s4xpos, ypos), 0); 181 } 182 } 183 } 184 185 if(CheckInventory("Zornhau")) 186 { 187 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("Zornhau"))) 188 { 189 DrawImage("SLOT5ICO", (s5xpos, ypos), 0); 190 } 191 else 192 { 193 if (bun.hasSword) 194 { 195 DrawImage("S5INACT", (s5xpos, ypos), 0); 196 } 197 else 198 { 199 DrawImage("S5UNA", (s5xpos, ypos), 0); 200 } 201 } 202 } 203 204 if(CheckInventory("Passe")) 205 { 206 if (bun.player.ReadyWeapon == Weapon(bun.FindInventory("Passe"))) 207 { 208 DrawImage("SLOT6ICO", (s6xpos, ypos), 0); 209 } 210 else 211 { 212 if (bun.hasSword) 213 { 214 DrawImage("S6INACT", (s6xpos, ypos), 0); 215 } 216 else 217 { 218 DrawImage("S6UNA", (s6xpos, ypos), 0); 219 } 220 } 221 } 222 } 223 }