The Desert Colossus

Community => Forum Games => Topic started by: DarkZelda on October 22, 2008, 01:59:28 PM

Title: Re: I'm so geeky game
Post by: DarkZelda on October 22, 2008, 01:59:28 PM
*continued from previous post*
Contents of KH_HUD.cpp

#include <allegro.h>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cmath>
#include <string>
#include <sstream>
#include <cstdlib>
#define pi 3.1415926535
#define null NULL
#define SCREEN_W 640
#define SCREEN_H 480
#include "allegset.h"
#include "HUD_outline.h"
using namespace std;

//***************************************************
//                 Player Class
// The class containing all the information that will
// be used in the HUD.
//***************************************************

class Player
{
      private:
              int HP,
                  MP,
                  maxHP,
                  maxMP,
                  tempHP;
              BITMAP *face; // We'll need to allocate new memory later!
      public:
             Player() // Player's default constructor.
             {
              HP = 30;
              maxHP = 30;
              maxMP = 100;
              MP = 100;
              face = NULL;
              tempHP = HP;
              face = null;
             
              face = load_bitmap("F:\\Dev-Cpp\\High Health.bmp",null);
             }
             int getHP() {return HP;}
             int getMP() {return MP;}
             int getmaxHP() {return maxHP;}
             int getmaxMP() {return maxMP;}
             void addmaxHP(int x) {maxHP += x;}
             void addHP(int x) {HP += x;}
             //void damage_check(int, int); // Void version of damage_check
             BITMAP * damage_check(int,int); // Bitmap version of damage_check
             BITMAP * get_face() {return face;} // An accessor that returns
                                                 // the bitmap of the player's
                                                 // face.
            
}; // End class definition.

BITMAP * Player::damage_check(int currentHP, int beforeHP)
{
bool damage = false; // Initialize the damage flag to false.

if (currentHP >= beforeHP)
    damage = false;
else if (currentHP < beforeHP && HP > 0)
    damage = true;

if (damage == false)
{
    if (currentHP > (*this).maxHP / 4) // If you have more than a quarter of your max HP left...
       (*this).face = load_bitmap("F:\\Dev-Cpp\\High Health.bmp",null); // ...you're good to go!
    else // If not...
       (*this).face = load_bitmap("F:\\Dev-Cpp\\Low Health.bmp",null); // ...you're screwed.
}
else // If damage IS taken...
    (*this).face = load_bitmap("F:\\Dev-Cpp\\Damage.bmp",null); // All hail the animation
                         
Title: Re: I'm so geeky game
Post by: DarkZelda on October 22, 2008, 02:02:03 PM
Example;
I'm so geeky that I'm on my blackberry on TDC during church.

(Second post because my phone is weird.)
Title: Re: I'm so geeky game
Post by: Keaton on October 22, 2008, 02:05:09 PM
I'm so geeky that I have 12 computers in my apartment right now, and spend more time with them than I do with the lovely ladies with whom I room.
Title: Re: I'm so geeky game
Post by: DarkZelda on October 22, 2008, 02:10:30 PM
(You moght have just won there. :-p)
I'm so geeky that I carry a DS lite, SP, and gameboy color in my purse all the time.
With extra games.
Title: Re: I'm so geeky game
Post by: Keaton on October 22, 2008, 02:22:42 PM
I'm so geeky, the last party I went to (actually, I hosted it) was a LAN party.
Title: Re: I'm so geeky game
Post by: Zelda Veteran on October 22, 2008, 05:10:18 PM
Quote from: Davy Jones on October 22, 2008, 02:22:42 PM
I'm so geeky, the last party I went to (actually, I hosted it) was a LAN party.
I'm so geeky, that that actually sounded like an awesome party. Wish I coulda gone :/
Title: Re: I'm so geeky game
Post by: DW on October 22, 2008, 05:28:23 PM
I'm so geeky I can't think of anything humorous to write.
Title: Re: I'm so geeky game
Post by: MagmarFire on October 22, 2008, 06:37:37 PM
I'm so geeky I sometimes do math just for fun.
Title: Re: I'm so geeky game
Post by: DarkZelda on October 22, 2008, 07:37:14 PM
I'm so geeky, I listen to geek podcasts.




Over and over again.
Title: Re: I'm so geeky game
Post by: Carpet Merchant on October 23, 2008, 06:43:03 AM
I'm so geeky that I've seen every Doctor Who episode since the 60s.


EDIT:
Geez, it's been a week. did I win?
Title: Re: I'm so geeky game
Post by: DarkZelda on November 02, 2008, 06:08:27 PM
Haha mabye.
Because that is rather geeky I must admit.

But I'm so geeky, I use chatspeak.

"LAWLZ N00B"
Title: Re: I'm so geeky game
Post by: MagmarFire on November 02, 2008, 07:19:17 PM
#include <iostream>
#include <string>
using namespace std;

int main()
{
string _1337 = "I'm so geeky that I'm using C++ to talk.";

cout << _1337 << endl;
return 0;
}
Title: Re: I'm so geeky game
Post by: Zelda Veteran on November 03, 2008, 03:00:20 PM
Magmar Wins.
END OF STORY.                                                  sequel?
Title: Re: I'm so geeky game
Post by: DarkZelda on November 03, 2008, 05:10:40 PM
Holy Crap.
Can anyone beat Magma Fire?
+1 Internets in Wookie
+2 Internets in Klingon
+over 9000 internets in hylian.
Title: Re: I'm so geeky game
Post by: MagmarFire on November 03, 2008, 06:11:38 PM
WHAT, NINE THOUSAND!? O.o

You know, I'm not sure if I should be flattered or ashamed. :P
Title: Re: I'm so geeky game
Post by: Carpet Merchant on November 03, 2008, 09:05:16 PM
Err lemme see....

I have created and field tested my own DND boardgame with three friends....

Still can't beat magmar. Damn.
Title: Re: I'm so geeky game
Post by: DW on November 03, 2008, 09:24:52 PM
Peh. You can't beat one of my friends. Spent...wow, can't even remember how many hours. Hundreds. Building this level 200 or something character.
Title: Re: I'm so geeky game
Post by: cacturnerules on November 07, 2008, 12:31:50 PM
I'M SO GEEKY, I went to burger king, and i got the happy meal. Just so i could have the pokemon card.


true story.
Title: Re: I'm so geeky game
Post by: KingKomali on November 23, 2008, 05:22:29 PM
lol rulez

I'm so geeky i read the dictonary for fun :P
Title: Re: I'm so geeky game
Post by: Gamefreak on November 23, 2008, 05:37:51 PM
MagmarFire, I see your C++ and I'll raise you one Java.

Once I remember.
Title: Re: I'm so geeky game
Post by: Mr. bubbles on December 13, 2008, 09:36:39 AM
Im so geeky im geeky.
Title: Re: I'm so geeky game
Post by: Fishalicious on December 13, 2008, 09:59:23 AM
I'm so geeky I'm watching X-Men on youtube with my Nightcrawler action figure on the desk next to me.
Title: Re: I'm so geeky game
Post by: Keaton on December 14, 2008, 09:20:51 PM
I'm so geeky, I played the Davy Jones medley.  On the pipe organ.  At my church.

For real.
Title: Re: I'm so geeky game
Post by: DW on December 14, 2008, 09:21:56 PM
I'm so geeky, I can hear that in my head.
Title: Re: I'm so geeky game
Post by: Aureliano on December 14, 2008, 09:22:36 PM
I'm so geeky I came back to TDC.
Title: Re: I'm so geeky game
Post by: Keaton on December 14, 2008, 09:25:11 PM
I'm so geeky, I'm a super-moderator on TDC.  The ONLY super-moderator on TDC.
Title: Re: I'm so geeky game
Post by: Aureliano on December 14, 2008, 09:27:30 PM
I'm so geeky that I want to be a super mod like Davy Jones
Title: Re: I'm so geeky game
Post by: Keaton on December 14, 2008, 09:28:16 PM
I'm so geeky, I could make that happen.

I'm so geeky, I reply to "DO NOT REPLY" email.
Title: Re: I'm so geeky game
Post by: Twilight Wolf on December 14, 2008, 09:35:18 PM
Quote from: Colonel Aureliano Buendia on December 14, 2008, 09:22:36 PM
I'm so geeky I came back to TDC.

And we're happy to have you!

I'm so geeky I've seen inside most of my game systems and their controllers.
Title: Re: I'm so geeky game
Post by: Aureliano on December 14, 2008, 09:37:38 PM
Kthxbai (thanks TW)

I'm so geeky I can bake brownies

True story
Title: Re: I'm so geeky game
Post by: MagmarFire on December 15, 2008, 01:58:43 PM
I'm so geeky that...

I'm first in my class here at MIT,
Got skills, I'm a champion at D&D,
M.C. Escher, that's my favorite M.C.,
Keep your 40; I'll just have an Earl Gray tea.

My rims never spin, to the contrary.
You'll find that they're quite stationary.
All my action figures are Cherry.
Stephen Hawking's in my library!

My MySpace page is so totally pimped out!
Got people begging for my top-eight spaces.
Yo, I know pi to a thousand places.
Ain't got no grills, but I still wear braces.
I make all my sandwiches with mayonnaise,
I'm a whiz at Minesweeper; I could play for days,
Once you've seen my sweet moves, you're going to stay amazed,
My fingers moving so fast I'll set the place ablaze.

There's a killer app I haven't run.
At Pascal, well, I'm number one!
Do vector calculus just for fun.
Ain't got a gat, but I got a soldering gun.
"Happy Days" is my favorite theme song.
I could sure kick your butt at a game of ping pong.
I'll ace any trivia quiz you bring on.
I'm fluent in JavaScript as well as Klingon!
Title: Re: I'm so geeky game
Post by: Gamefreak on December 15, 2008, 02:28:59 PM
continued from Magmar's post:

I've been browsing, inspectin'
X-men comics you know I collect 'em
The pens in my pocket
I must protect 'em
my ergonomic keyboard never leaves me bored
Shopping online for deals on some writable media
I edit Wikipedia
I memorized Holy Grail really well
I can recite it right now and have you ROTFLOL
I got a business doing websites
When my friends need some code who do they call?
I do HTML for them all
Even made a homepage for my dog!
Yo! Got myself a fanny pack
they were having a sale down at the GAP
Spend my nights with a roll of bubble wrap
POP POP! Hope no one sees me gettin' freaky!

I'm nerdy in the extreme and whiter than sour creme
I was in AV club and Glee club and even the chess team!
Only question I ever thought was hard
Was do I like Kirk or do I like Picard?
I spend every weekend
at the renaissance fair
I got my name on my under wear!
Title: Re: I'm so geeky game
Post by: Pyrgusfinn on December 16, 2008, 06:54:54 PM
oh my...
I'm so geeky that I enjoy editing other people's essays and research papers.

MOD EDIT:  I'm so geeky that I enjoy editing other people's posts.
Title: Re: I'm so geeky game
Post by: Twilight Wolf on December 16, 2008, 09:23:25 PM
I'm so geeky that the first thing I did when I bought a new Sega Genesis controller yesterday was open it up and clean it inside and out.
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on December 22, 2008, 07:23:12 PM
I'm So geeky that i laugh at these jokes  ;)
Title: Re: I'm so geeky game
Post by: KingKomali on January 06, 2009, 06:09:41 PM
I'm so geeky I have a Bleach poster inside my school locker ;)
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on January 09, 2009, 11:03:29 AM
I'm so geeky that I own every zelda game and want to import the Tingle RPG. Yes I also know almost every quote, and have done 3 heart challenge on all. *I need a life...*
Title: Re: I'm so geeky game
Post by: alical on January 20, 2009, 01:41:57 PM
I'm so geeky I've been checking Joules, Jack Wills, and American Eagle almost religiously every day to see if sale prices have gone down.
Then I went a bit mental at the Sterling to Dollar exchange rate. 
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on January 22, 2009, 11:34:57 AM
I'm so geekey I shop at the gap.
Title: Re: I'm so geeky game
Post by: Pyrgusfinn on January 26, 2009, 06:41:06 PM
Im so geeky that instead of thinking of the store Gap, i thought of the Global Awareness Program.
Title: Re: I'm so geeky game
Post by: Pale Dim on January 26, 2009, 06:46:26 PM
I'm so geeky that
I only like Nintendo...everything else can go away...
I have done huge amounts of research on Star wars, I consider myself a nerd. Heck, I have a Clone trooper outfit in my closet!
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on January 27, 2009, 06:18:42 PM
1'm s0 g33k7 1 s933k 1337.
Title: Re: I'm so geeky game
Post by: Hi no Seijin on January 27, 2009, 06:20:46 PM
I'm so anti-leet I maim you for that.
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on January 27, 2009, 06:25:57 PM
I'm so geeky I say lol at that.
Title: Re: I'm so geeky game
Post by: alical on February 02, 2009, 06:27:52 AM
I'm so geeky that I've pre ordered and and am VERY excited about the SIms 3.
Although i am not so geeky as to get the collector's edition, what a rip off.
Title: Re: I'm so geeky game
Post by: KingKomali on February 12, 2009, 01:46:25 PM
I'm so geeky I like to show off my zelda apparel!! ;D
Title: Re: I'm so geeky game
Post by: Pale Dim on February 12, 2009, 04:08:09 PM
I'm so geeky I train myself in the ways of a lightsaber...
Title: Re: I'm so geeky game
Post by: cacturnerules on February 12, 2009, 04:23:55 PM
I'm so geeky, I've had a keyblade since before they even started making Kingdom Hearts.
Title: Re: I'm so geeky game
Post by: MagmarFire on February 12, 2009, 04:25:02 PM
You lie so epically. Therefore, you get this program:

#include <iostream>
using namespace std;

int main()
{
for (int i = 0; i > -1; i++)
cout << "\a";
return 0;
}


I dare you to compile that. :P
Title: Re: I'm so geeky game
Post by: cacturnerules on February 12, 2009, 04:34:35 PM
*Violently asplodes*

No lie. If I ever get a digital camera, I'll have pics.



I'm so geeky I have a small fishbowl that has 2 plastic fish that swim around by using magnets in the tank.  :P
Title: Re: I'm so geeky game
Post by: Pale Dim on February 12, 2009, 04:43:39 PM
Read this.
---
-- Copyright (c) 2005 Pandemic Studios, LLC. All rights reserved.
--

-- load the gametype script
ScriptCB_DoFile("ObjectiveConquest")
ScriptCB_DoFile("setup_teams")

--  Empire Attacking (attacker is always #1)
     REP = 1
     CIS = 2
     --  These variables do not change
     ATT = 1
     DEF = 2
     
function ScriptPostLoad()

    EnableSPHeroRules()
   
    cp1 = CommandPost:New{name = "cp2"}
    cp2 = CommandPost:New{name = "CP3"}
    cp3 = CommandPost:New{name = "CP5"}
    cp4 = CommandPost:New{name = "CP6"}
    cp5 = CommandPost:New{name = "CP7"}
   
    conquest = ObjectiveConquest:New{teamATT = ATT, teamDEF = DEF, textATT = "game.modes.con", textDEF = "game.modes.con2", multiplayerRules = true}
   
    conquest:AddCommandPost(cp1)
    conquest:AddCommandPost(cp2)
    conquest:AddCommandPost(cp3)
    conquest:AddCommandPost(cp4)
    conquest:AddCommandPost(cp5)
   
  conquest:Start()
   
end

---------------------------------------------------------------------------
-- FUNCTION:    ScriptInit
-- PURPOSE:     This function is only run once
-- INPUT:
-- OUTPUT:
-- NOTES:       The name, 'ScriptInit' is a chosen convention, and each
--              mission script must contain a version of this function, as
--              it is called from C to start the mission.
---------------------------------------------------------------------------
function ScriptInit()
    StealArtistHeap(256*1024)
    -- Designers, these two lines *MUST* be first.
    SetPS2ModelMemory(2497152 + 65536 * 0)
    ReadDataFile("ingame.lvl")
   
    SetMemoryPoolSize ("ClothData",20)
    SetMemoryPoolSize ("Combo",30)              -- should be ~ 2x number of jedi classes
    SetMemoryPoolSize ("Combo::State",500)      -- should be ~12x #Combo
    SetMemoryPoolSize ("Combo::Transition",500) -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Condition",500)  -- should be a bit bigger than #Combo::State
    SetMemoryPoolSize ("Combo::Attack",400)     -- should be ~8-12x #Combo
    SetMemoryPoolSize ("Combo::DamageSample",4000)  -- should be ~8-12x #Combo::Attack
    SetMemoryPoolSize ("Combo::Deflect",88)     -- should be ~1x #combo
   
   ReadDataFile("dc:sound\\hero.lvl;herogcw")
    ReadDataFile("sound\\fel.lvl;fel1cw")

    SetMaxFlyHeight(30)
    SetMaxPlayerFlyHeight(30)

    ReadDataFile("SIDE\\rep.lvl",
                "rep_inf_ep3_rifleman",
                "rep_inf_ep3_rocketeer",
                "rep_inf_ep3_engineer",
                "rep_inf_ep3_sniper",
                "rep_inf_ep3_officer",
                "rep_inf_ep3_jettrooper",
                "rep_walk_atte",
                "rep_walk_oneman_atst")
               
    ReadDataFile("SIDE\\cis.lvl",
                "cis_inf_rifleman",
                "cis_inf_rocketeer",
                "cis_inf_engineer",
                "cis_inf_officer",
                "cis_inf_sniper",
                "cis_inf_droideka",
                "cis_tread_snailtank")
   
       ReadDataFile("SIDE\\tur.lvl",
        "tur_bldg_laser")
       
            ReadDataFile("dc:SIDE\\dlc.lvl",
                "dlc_hero_fisto",
                "dlc_hero_ventress")
       
   SetupTeams{
        rep = {
            team = REP,
            units = 20,
            reinforcements = 150,
            soldier = { "rep_inf_ep3_rifleman",9, 25},
            assault = { "rep_inf_ep3_rocketeer",1,4},
            engineer = { "rep_inf_ep3_engineer",1,4},
            sniper  = { "rep_inf_ep3_sniper",1,4},
            officer = {"rep_inf_ep3_officer",1,4},
            special = { "rep_inf_ep3_jettrooper",1,4},
           
        },
        cis = {
            team = CIS,
            units = 20,
            reinforcements = 150,
            soldier = { "cis_inf_rifleman",9, 25},
            assault = { "cis_inf_rocketeer",1,4},
            engineer = { "cis_inf_engineer",1,4},
            sniper  = { "cis_inf_sniper",1,4},
            officer = {"cis_inf_officer",1,4},
            special = { "cis_inf_droideka",1,4},
        }
    }

    SetHeroClass(REP, "dlc_hero_fisto")
    SetHeroClass(CIS, "dlc_hero_ventress")

--  Level Stats
    ClearWalkers()
    SetMemoryPoolSize ("EntityWalker",-1)
    AddWalkerType(0, 12) -- 12 droidekas
    AddWalkerType(1, 2) -- 0 atsts with 1 leg pairs each
    AddWalkerType(2, 0) -- 0 atats with 2 leg pairs each
    AddWalkerType(3, 1) -- 2 attes with 3 leg pairs each
    SetMemoryPoolSize("Commandwalker", 1)
--  SetMemoryPoolSize("EntityFlyer", 5)
    SetMemoryPoolSize("EntityHover", 6)
    SetMemoryPoolSize("MountedTurret", 48)
    SetMemoryPoolSize("PowerupItem", 60)
    SetMemoryPoolSize("EntityMine", 40)
    SetMemoryPoolSize("Weapon", 280)
    ReadDataFile("dc:RHN\\RHN1.lvl","RhenVar1_conquest")
    SetSpawnDelay(10.0, 0.25)
    SetDenseEnvironment("false")
--  AddDeathRegion("Death");

--  AI
    SetAIVehicleNotifyRadius(80)
    SetMaxFlyHeight(30)
    SetMaxPlayerFlyHeight(30)   

    --  Sound Stats
   
    voiceSlow = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_slow")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_slow", voiceSlow)
    AudioStreamAppendSegments("sound\\global.lvl", "global_vo_slow", voiceSlow)
   
    voiceQuick = OpenAudioStream("sound\\global.lvl", "rep_unit_vo_quick")
    AudioStreamAppendSegments("sound\\global.lvl", "cis_unit_vo_quick", voiceQuick)   
   
    OpenAudioStream("sound\\global.lvl",  "cw_music")
    OpenAudioStream("sound\\fel.lvl",  "fel1")
    OpenAudioStream("sound\\fel.lvl",  "fel1")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_quick")
    -- OpenAudioStream("sound\\global.lvl",  "global_vo_slow")
    -- OpenAudioStream("sound\\fel.lvl",  "fel1_emt")

    SetBleedingVoiceOver(REP, REP, "rep_off_com_report_us_overwhelmed", 1)
    SetBleedingVoiceOver(REP, CIS, "rep_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(CIS, REP, "cis_off_com_report_enemy_losing",   1)
    SetBleedingVoiceOver(CIS, CIS, "cis_off_com_report_us_overwhelmed", 1)

    SetOutOfBoundsVoiceOver(1, "Repleaving")
    SetOutOfBoundsVoiceOver(2, "Cisleaving")

    SetAmbientMusic(REP, 1.0, "rep_fel_amb_start",  0,1)
    SetAmbientMusic(REP, 0.8, "rep_fel_amb_middle", 1,1)
    SetAmbientMusic(REP, 0.2,"rep_fel_amb_end",    2,1)
    SetAmbientMusic(CIS, 1.0, "cis_fel_amb_start",  0,1)
    SetAmbientMusic(CIS, 0.8, "cis_fel_amb_middle", 1,1)
    SetAmbientMusic(CIS, 0.2,"cis_fel_amb_end",    2,1)

    SetVictoryMusic(REP, "rep_fel_amb_victory")
    SetDefeatMusic (REP, "rep_fel_amb_defeat")
    SetVictoryMusic(CIS, "cis_fel_amb_victory")
    SetDefeatMusic (CIS, "cis_fel_amb_defeat")

    SetSoundEffect("ScopeDisplayZoomIn",  "binocularzoomin")
    SetSoundEffect("ScopeDisplayZoomOut", "binocularzoomout")
    --SetSoundEffect("WeaponUnableSelect",  "com_weap_inf_weaponchange_null")
    --SetSoundEffect("WeaponModeUnableSelect",  "com_weap_inf_modechange_null")
    SetSoundEffect("SpawnDisplayUnitChange",       "shell_select_unit")
    SetSoundEffect("SpawnDisplayUnitAccept",       "shell_menu_enter")
    SetSoundEffect("SpawnDisplaySpawnPointChange", "shell_select_change")
    SetSoundEffect("SpawnDisplaySpawnPointAccept", "shell_menu_enter")
    SetSoundEffect("SpawnDisplayBack",             "shell_menu_exit")


--  Camera Stats

--  Top Down
    AddCameraShot(0.876900, -0.442794, 0.166961, 0.084308, -92.842827, 91.021690, 161.355850);
--  CP3
    AddCameraShot(0.931816, -0.181206, -0.308678, -0.060027, -147.396545, 25.021837, 128.233185);
    AddCameraShot(0.909842, -0.262073, 0.309156, 0.089050, -91.736038, 34.621788, 163.739639);
--  CP5
I read these and deal with them everyday.
Title: Re: I'm so geeky game
Post by: MagmarFire on February 20, 2009, 04:23:55 PM
Okay, seriously, what language is that!? I'm thinking it's some twisted form of Ruby, but I can't put my finger on it. ???

Still, if you think that's bad, then take a look at this:

Contents of HUD_outline.h
#ifndef OUTLINE_H
#define OUTLINE_H
#include <allegro.h>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cmath>
#include <string>
#include <sstream>
#define pi 3.1415926535
#include "allegset.h"
using namespace std;

//**********************************************************
//                    Kingdom Hearts HUD
//        Creates the HUD that we all know and love.
//**********************************************************

void drawHUD(int maxHP, int bigrad, int smallrad, BITMAP *buffer, int HP, int MP, int maxMP,
int x, int y)
{
     // First, we check to see if the player's current HP is greater than his or her
     // max HP.
    if (HP > maxHP)
        HP = maxHP;
       
     // These circles mark the area where the face will be. They're just for decoration, really.
     if (maxHP > 90)
     {
     arc(buffer,(x),(y),itofix(hexa(180)),itofix(hexa(243)),
          ((bigrad + smallrad)/2),makecol(40,40,40));
     }
     else
     {
     arc(buffer,(x),(y),itofix(hexa(180)),itofix(hexa((maxHP + 1) * -1)),
          ((bigrad + smallrad)/2),makecol(40,40,40));
     }
     // These are the coordinate initializations for the end border.
double endbigx = x - (bigrad - 1) * cos(rad(maxHP) + pi), // The "(bigrad + or - 1)" changes
  // the length of the end border.
        endbigy = y - (bigrad - 1) * sin(rad(maxHP) + pi),
        endsmallx = x - (smallrad + 1) * cos(rad(maxHP) + pi),
        endsmally = y - (smallrad + 1)* sin(rad(maxHP) + pi);
    
    /* Beginning border */ line(buffer,(x - bigrad),(y),
    (x - smallrad),(y),makecol(40,40,40));

    if (maxHP < 90) // This is where the piecewise processing is done.
                    // If the character's maximum HP is greater than 90, then
                    // the arc will stop arcing and will introduce the straight bar.
    {
      arc(buffer, x, y,
          itofix(hexa((maxHP * -1))), itofix(hexa(180)), bigrad, makecol(40,40,40));
                                                                          
      arc(buffer, x,y,itofix(hexa((maxHP * -1))),
          itofix(hexa(180)),smallrad,makecol(40,40,40));
      if (HP < maxHP)
      {
      line(buffer,endbigx,endbigy,endsmallx,endsmally,
           makecol(40,40,40)); // Draws the end border.
      }
    }
    else
    {
    arc(buffer,x,y,itofix(hexa(270)),itofix(hexa(180)),
         bigrad,makecol(40,40,40));
    arc(buffer,x,y,itofix(hexa(270)),itofix(hexa(180)),
         smallrad,makecol(40,40,40));
   
    /* Bottom border */line(buffer,(x + 2),(y + bigrad),
    (x - maxHP + 2 * bigrad - (bigrad - smallrad)/2 - smallrad + 2),
    (y + bigrad),makecol(40,40,40));
   
    /* Top border */line(buffer,(x + 2u),(y + smallrad),
         (x - maxHP + 2 * bigrad - (bigrad - smallrad)/2 - smallrad + 2),
         (y + smallrad),makecol(40,40,40));
   
    line(buffer,(x - maxHP + 90),(y + smallrad),
         (x - maxHP + 90),(y + bigrad),makecol(40,40,40));
    }

// The following variables will be assigned to the HP value to begin processes for the
// actual HP part of the arc.

endbigx = x - (bigrad) * cos(rad(HP - 1) + pi),
endbigy = y - (bigrad) * sin(rad(HP - 1) + pi),
endsmallx = x - (smallrad) * cos(rad(HP - 1) + pi),
endsmally = y - (smallrad)* sin(rad(HP - 1) + pi);

if (HP < 90)
    {
      line(buffer,endbigx,endbigy,endsmallx,endsmally,
           makecol(0,255,0)); // Draws the end border.
    }
else
    {
      if (HP > 0)
      {
         line(buffer,(x - HP + 90),(y + smallrad + 1),
            (x - HP + 90),(y + bigrad - 1),makecol(0,255,0));
      }
      else
      {
          line(buffer, (x - bigrad),y,(x - smallrad),y,makecol(0,0,0));
      }
         
    }

if ((HP + 180) > 0)
    {
floodfill(buffer,(x - bigrad + (bigrad - smallrad)/2 + 1),
     (y - 2),makecol(0,255,0)); // Gives us the green!
    }
    //******************************************
    // Now we go into the MP portion of the HUD!
    //******************************************
    int shortcut_y = y + bigrad - (bigrad - smallrad)/2;
   
    // MP bar outline
    filletrect(buffer,(x - bigrad + 63),(y + bigrad - 3 * (bigrad - smallrad)/2),
     (x - bigrad - 2 * maxMP),
     (y + bigrad - (bigrad - smallrad)/2),/* Radius */.25,250,250,250);
    
    rectfill(buffer,(x - bigrad + 62),(y + bigrad - 3 * (bigrad - smallrad)/2 + 1),
        (x - bigrad - 2 * maxMP + 1),(y + bigrad - (bigrad - smallrad)/2 - 1),makecol(10,10,10));
   
    textout_ex(buffer,font,"MP",(x - bigrad + .55 * bigrad),
        (y + 1.04 * bigrad - 3 * (bigrad - smallrad)/2 + 1),
        makecol(0,0,255), makecol(0,0,0));
   
    rectfill(buffer,(x - bigrad + .49 * bigrad),(y + bigrad - 3 * (bigrad - smallrad)/2 + 1),
        (x - bigrad - 2 * MP + 1),(y + bigrad - (bigrad - smallrad)/2 - 1),
        makecol(0,0,255));
}
#endif
Title: Re: I'm so geeky game
Post by: MagmarFire on February 28, 2009, 05:55:26 PM
*continued from previous post*
Contents of KH_HUD.cpp

#include <allegro.h>
#include <iostream>
#include <cmath>
#include <ctime>
#include <cmath>
#include <string>
#include <sstream>
#include <cstdlib>
#define pi 3.1415926535
#define null NULL
#define SCREEN_W 640
#define SCREEN_H 480
#include "allegset.h"
#include "HUD_outline.h"
using namespace std;

//***************************************************
//                 Player Class
// The class containing all the information that will
// be used in the HUD.
//***************************************************

class Player
{
      private:
              int HP,
                  MP,
                  maxHP,
                  maxMP,
                  tempHP;
              BITMAP *face; // We'll need to allocate new memory later!
      public:
             Player() // Player's default constructor.
             {
              HP = 30;
              maxHP = 30;
              maxMP = 100;
              MP = 100;
              face = NULL;
              tempHP = HP;
              face = null;
             
              face = load_bitmap("F:\\Dev-Cpp\\High Health.bmp",null);
             }
             int getHP() {return HP;}
             int getMP() {return MP;}
             int getmaxHP() {return maxHP;}
             int getmaxMP() {return maxMP;}
             void addmaxHP(int x) {maxHP += x;}
             void addHP(int x) {HP += x;}
             //void damage_check(int, int); // Void version of damage_check
             BITMAP * damage_check(int,int); // Bitmap version of damage_check
             BITMAP * get_face() {return face;} // An accessor that returns
                                                 // the bitmap of the player's
                                                 // face.
            
}; // End class definition.

BITMAP * Player::damage_check(int currentHP, int beforeHP)
{
bool damage = false; // Initialize the damage flag to false.

if (currentHP >= beforeHP)
    damage = false;
else if (currentHP < beforeHP && HP > 0)
    damage = true;

if (damage == false)
{
    if (currentHP > (*this).maxHP / 4) // If you have more than a quarter of your max HP left...
       (*this).face = load_bitmap("F:\\Dev-Cpp\\High Health.bmp",null); // ...you're good to go!
    else // If not...
       (*this).face = load_bitmap("F:\\Dev-Cpp\\Low Health.bmp",null); // ...you're screwed.
}
else // If damage IS taken...
    (*this).face = load_bitmap("F:\\Dev-Cpp\\Damage.bmp",null); // All hail the animation
                                                                // that is pretty much the
                                                                // main reason why I wrote
                                                                // this program to begin with!
    return (*this).face; // Return the appropriate face.
}

//*******************************************
//     SAMPLES, BITMAPS, AND PROTOTYPES
//*******************************************

    BITMAP *buffer = NULL;
    BITMAP *enemy = null;
    SAMPLE *F = null;
    SAMPLE *song = null;
    SAMPLE *siren = null;
   
    int hexa(int); // Function prototypes
    int hex_to_HP(int);
    void face_change();
    void siren_check(Player, int &, int);

int main(int argc, char *argv[])
{  
    int seed = time(0);
    srand(seed);
    alleg_setup(); // A shorthand function I created that sets up default Allegro configurations.
   
    Player Sora;
    buffer = create_bitmap(640,480);
    enemy = load_bitmap("F:\\Dev-Cpp\\Enemy.bmp",null);
    F = load_sample("F:\\F!.wav");
    song = load_sample("F:\\dearlybelovedreprise.wav");
    siren = load_sample("F:\\Crappy KH Low Health.wav");
   

    int arc1 = 0, arc2 = 0;
    int bigrad = 80, smallrad = 64; // Radii of the arcs in the HUD.
                             // Prefered bigrad:smallrad ratio = 1.25:1
                            
    int HUDx = 550, // The HUD's center coordinates.
        HUDy = SCREEN_H / 2 + 150;
    int HP = Sora.getHP(), maxHP = Sora.getmaxHP(), MP = Sora.getMP(),
        maxMP = Sora.getmaxMP();
       
    int tempHP = HP; // tempHP will hold the original HP; this is for checking
                     // to see if the player takes damage at all during each
                     // of the HUD's iterations.
                    
    int sleep = 50; // Sets the amount of time
                    // in the interval between
                    // each while loop iteration.
    int rest_request = 500;
   
    int direction = 0,
        enX = 0,
        enY = 0;
   
    while (!key[KEY_ESC])
    {
          // Variable reassignments.
         
          tempHP = HP;
          HP = Sora.getHP();
          maxHP = Sora.getmaxHP();
          MP = Sora.getMP();
          maxMP = Sora.getmaxMP();
          //direction = rand() % 4 + 1;
          if (direction == 1)
             enX++;
          else if (direction == 2)
               enY--;
          else if (direction == 3)
               enX--;
          else if (direction == 4)
               enY++;
         
          if (key[KEY_RIGHT])
             Sora.addmaxHP(1);   
          if (key[KEY_LEFT])
             Sora.addmaxHP(-1); 
          if (key[KEY_UP] || direction == 1)
          {
             /*for (int i = Sora.getHP(); i > Sora.getHP() - 10; i = Sora.getHP())
               {
               Sora.addHP(-1);
               rest(10);
               }*/
               Sora.addHP(-3);
                while (key[KEY_UP])
               {}
               play_sample(F,255,150,1000,0);
             
          }
          else if (key[KEY_DOWN])
          Sora.addHP(3);
          else if (key[KEY_U] || direction == 4)
          {
          HP += 2;
          }
          else if (key[KEY_D])
          {
          HP -= 2;
             while (key[KEY_D])
             {}
          }
          if (key[KEY_M])
          MP += 1;
          else if (key[KEY_N])
          MP -= 1;
         
          if (key[KEY_P])
             play_sample(song,255,150,1000,0);
        
         siren_check(Sora,rest_request,sleep);
         
          if (HP < 0)
             HP = 0;
   
    acquire_screen(); //Begin the screen acquirement.
   
    drawHUD(hex_to_HP(maxHP - 60),bigrad,smallrad,buffer,hex_to_HP(HP - 60),
         MP,maxMP,HUDx,HUDy); // We want degrees, not hexes!
    draw_sprite(buffer,Sora.damage_check(HP,tempHP),(HUDx - Sora.get_face()->w / 2),HUDy);
        
    draw_sprite(buffer,enemy,enX,enY);   
    blit(buffer,screen,0,0,0,0,640,480);
   
    release_screen(); // Release what has been acquired for the screen.
    rest(sleep);
    clear_bitmap(buffer);
    }
   
    destroy_bitmap(buffer);
    return 0;
}
END_OF_MAIN();

int hex_to_HP(int HP)
{
    return 3 * HP;
}
END_OF_FUNCTION();
   
void siren_check(Player object, int &rest_request, int rest_main)
{
if (object.getHP() <= object.getmaxHP() / 4) // Checks to see if the player's HP is less than
   {                                        // quarter-max.
   if (rest_request % 450 == 0) //
      {
          play_sample(siren,255,150,1000,0);
          rest_request = 0;
          rest_request += rest_main;
      }
   else
       rest_request += rest_main;
   }
}
END_OF_FUNCTION();


That doesn't even include the allegset.h header file. And I'm still not done with this.

I'm the geekiest by far, no?
Title: Re: I'm so geeky game
Post by: TP Zelda on February 28, 2009, 06:18:26 PM
i'm so geeky i don't know what magz is talking about XDDD
Title: Re: I'm so geeky game
Post by: The Glamour Nazi on March 09, 2009, 03:56:58 PM
I'm so geeky I think mags is geeky.