• Welcome to The Desert Colossus.
 

News:

Welcome to the Desert!  Register, post, and have fun.  Why not introduce yourself in the
Welcome Thread?

Main Menu

Re: I'm so geeky game

Started by DarkZelda, October 22, 2008, 01:59:28 PM

Previous topic - Next topic

KingKomali

I'm so geeky I like to show off my zelda apparel!! ;D

Pale Dim

I'm so geeky I train myself in the ways of a lightsaber...


3308-7723-6389

cacturnerules

I'm so geeky, I've had a keyblade since before they even started making Kingdom Hearts.

MagmarFire

#48
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



Advanceshipping and Rion had better be Chuck Norris approved.

cacturnerules

*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

Pale Dim

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.


3308-7723-6389

MagmarFire

#51
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



Advanceshipping and Rion had better be Chuck Norris approved.

MagmarFire

#52
*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?



Advanceshipping and Rion had better be Chuck Norris approved.

TP Zelda

i'm so geeky i don't know what magz is talking about XDDD

The Glamour Nazi

I'm so geeky I think mags is geeky.