home *** CD-ROM | disk | FTP | other *** search
/ Doom 2 Explosion / Doom2Explosion.bin / doom2exp / programs / deu521 / source / things.c < prev    next >
C/C++ Source or Header  |  1994-03-30  |  13KB  |  561 lines

  1. /*
  2.    Doom Editor Utility, by Brendon Wyber and Raphaël Quinet.
  3.  
  4.    You are allowed to use any parts of this code in another program, as
  5.    long as you give credits to the authors in the documentation and in
  6.    the program itself.  Read the file README.1ST for more information.
  7.  
  8.    This program comes with absolutely no warranty.
  9.  
  10.    THINGS.C - Thing name and type routines.
  11. */
  12.  
  13. /* the includes */
  14. #include "deu.h"
  15. #include "things.h"
  16.  
  17.  
  18. /*
  19.    get the colour of a thing
  20. */
  21.  
  22. int GetThingColour( int type)
  23. {
  24.    if (Colour2)
  25.    {
  26.       switch( type)
  27.       {
  28.       case THING_PLAYER1:
  29.       case THING_PLAYER2:
  30.       case THING_PLAYER3:
  31.       case THING_PLAYER4:
  32.      return GREEN;
  33.       case THING_DEATHMATCH:
  34.      return LIGHTGREEN;
  35.  
  36.       case THING_SARGEANT:
  37.       case THING_TROOPER:
  38.       case THING_IMP:
  39.       case THING_DEMON:
  40.       case THING_SPECTOR:
  41.       case THING_LOSTSOUL:
  42.      return RED;
  43.       case THING_BARON:
  44.       case THING_CACODEMON:
  45.       case THING_SPIDERBOSS:
  46.       case THING_CYBERDEMON:
  47.      return LIGHTRED;
  48.  
  49.       /* Things you can always pick up */
  50.       case THING_BLUECARD:
  51.       case THING_YELLOWCARD:
  52.       case THING_REDCARD:
  53.       case THING_ARMBONUS1:
  54.       case THING_HLTBONUS1:
  55.      return MAGENTA;
  56.       case THING_BLUESKULLKEY:
  57.       case THING_YELLOWSKULLKEY:
  58.       case THING_REDSKULLKEY:
  59.       case THING_SOULSPHERE:
  60.       case THING_RADSUIT:
  61.       case THING_MAP:
  62.       case THING_BLURSPHERE:
  63.       case THING_BESERK:
  64.       case THING_INVULN:
  65.       case THING_LITEAMP:
  66.       case THING_BACKPACK:
  67.      return LIGHTMAGENTA;
  68.  
  69.       /* Guns */
  70.       case THING_SHOTGUN:
  71.       case THING_CHAINSAW:
  72.       case THING_CHAINGUN:
  73.      return BLUE;
  74.       case THING_LAUNCHER:
  75.       case THING_PLASMAGUN:
  76.       case THING_BFG9000:
  77.      return LIGHTBLUE;
  78.  
  79.       /* Things you can't always pick up */
  80.       case THING_AMMOCLIP:
  81.       case THING_SHELLS:
  82.       case THING_ROCKET:
  83.       case THING_ENERGYCELL:
  84.       case THING_GREENARMOR:
  85.       case THING_STIMPACK:
  86.      return CYAN;
  87.       case THING_AMMOBOX:
  88.       case THING_SHELLBOX:
  89.       case THING_ROCKETBOX:
  90.       case THING_ENERGYPACK:
  91.       case THING_BLUEARMOR:
  92.       case THING_MEDKIT:
  93.      return LIGHTCYAN;
  94.  
  95.       /* Decorations, et al */
  96.       case THING_TECHCOLUMN:
  97.       case THING_TGREENPILLAR:
  98.       case THING_TREDPILLAR:
  99.       case THING_SGREENPILLAR:
  100.       case THING_SREDPILLAR:
  101.       case THING_PILLARHEART:
  102.       case THING_PILLARSKULL:
  103.       case THING_EYEINSYMBOL:
  104.       case THING_GREYTREE:
  105.       case THING_BROWNSTUB:
  106.       case THING_BROWNTREE:
  107.       case THING_LAMP:
  108.       case THING_CANDLE:
  109.       case THING_CANDELABRA:
  110.       case THING_TBLUETORCH:
  111.       case THING_TGREENTORCH:
  112.       case THING_TREDTORCH:
  113.       case THING_SBLUETORCH:
  114.       case THING_SGREENTORCH:
  115.       case THING_SREDTORCH:
  116.       case THING_DEADPLAYER:
  117.       case THING_DEADTROOPER:
  118.       case THING_DEADSARGEANT:
  119.       case THING_DEADIMP:
  120.       case THING_DEADDEMON:
  121.       case THING_DEADCACODEMON:
  122.       case THING_DEADLOSTSOUL:
  123.       case THING_BONES:
  124.       case THING_BONES2:
  125.       case THING_POOLOFBLOOD:
  126.       case THING_SKULLTOPPOLE:
  127.       case THING_HEADSKEWER:
  128.       case THING_PILEOFSKULLS:
  129.       case THING_IMPALEDBODY:
  130.       case THING_IMPALEDBODY2:
  131.       case THING_SKULLSINFLAMES:
  132.       case THING_HANGINGSWAYING:
  133.       case THING_HANGINGARMSOUT:
  134.       case THING_HANGINGONELEG:
  135.       case THING_HANGINGTORSO:
  136.       case THING_HANGINGLEG:
  137.       case THING_HANGINGSWAYING2:
  138.       case THING_HANGINGARMSOUT2:
  139.       case THING_HANGINGONELEG2:
  140.       case THING_HANGINGTORSO2:
  141.       case THING_HANGINGLEG2:
  142.     return BROWN;
  143.       case THING_BARREL:
  144.       case THING_TELEPORT:
  145.      return YELLOW;
  146.       }
  147.    }
  148.    else
  149.    {
  150.       switch( type)
  151.       {
  152.       case THING_PLAYER1:
  153.       case THING_PLAYER2:
  154.       case THING_PLAYER3:
  155.       case THING_PLAYER4:
  156.       case THING_DEATHMATCH:
  157.      return GREEN;
  158.       case THING_SARGEANT:
  159.       case THING_TROOPER:
  160.       case THING_IMP:
  161.       case THING_DEMON:
  162.       case THING_SPECTOR:
  163.       case THING_BARON:
  164.       case THING_LOSTSOUL:
  165.       case THING_CACODEMON:
  166.       case THING_SPIDERBOSS:
  167.       case THING_CYBERDEMON:
  168.      return LIGHTRED;
  169.       case THING_BLUECARD:
  170.       case THING_YELLOWCARD:
  171.       case THING_REDCARD:
  172.       case THING_BLUESKULLKEY:
  173.       case THING_YELLOWSKULLKEY:
  174.       case THING_REDSKULLKEY:
  175.       case THING_ARMBONUS1:
  176.       case THING_HLTBONUS1:
  177.       case THING_GREENARMOR:
  178.       case THING_BLUEARMOR:
  179.       case THING_SOULSPHERE:
  180.       case THING_MEDKIT:
  181.       case THING_STIMPACK:
  182.       case THING_RADSUIT:
  183.       case THING_MAP:
  184.       case THING_BLURSPHERE:
  185.       case THING_BESERK:
  186.       case THING_INVULN:
  187.       case THING_LITEAMP:
  188.      return LIGHTGREEN;
  189.       case THING_SHOTGUN:
  190.       case THING_CHAINSAW:
  191.       case THING_CHAINGUN:
  192.       case THING_LAUNCHER:
  193.       case THING_PLASMAGUN:
  194.       case THING_BFG9000:
  195.       case THING_AMMOCLIP:
  196.       case THING_AMMOBOX:
  197.       case THING_SHELLS:
  198.       case THING_SHELLBOX:
  199.       case THING_ROCKET:
  200.       case THING_ROCKETBOX:
  201.       case THING_ENERGYCELL:
  202.       case THING_ENERGYPACK:
  203.       case THING_BACKPACK:
  204.      return BROWN;
  205.       }
  206.    }
  207.    return WHITE;
  208. }
  209.  
  210.  
  211.  
  212. /*
  213.    get the name of a thing
  214. */
  215.  
  216. char *GetThingName( int type)
  217. {
  218.    static char temp[ 20];
  219.  
  220.    switch( type)
  221.    {
  222.    /* the players */
  223.    case THING_PLAYER1:
  224.       return "Player 1 Start";
  225.    case THING_PLAYER2:
  226.       return "Player 2 Start";
  227.    case THING_PLAYER3:
  228.       return "Player 3 Start";
  229.    case THING_PLAYER4:
  230.       return "Player 4 Start";
  231.    case THING_DEATHMATCH:
  232.       return "DEATHMATCH Start";
  233.  
  234.    /* enemies */
  235.    case THING_SARGEANT:
  236.       return "Sargeant";
  237.    case THING_TROOPER:
  238.       return "Trooper";
  239.    case THING_IMP:
  240.       return "Imp";
  241.    case THING_DEMON:
  242.       return "Demon";
  243.    case THING_BARON:
  244.       return "Baron";
  245.    case THING_SPECTOR:
  246.       return "Spector";
  247.    case THING_LOSTSOUL:
  248.       return "Lost Soul";
  249.    case THING_CACODEMON:
  250.       return "Cacodemon";
  251.    case THING_SPIDERBOSS:
  252.       return "Spider Boss";
  253.    case THING_CYBERDEMON:
  254.       return "Cyber Demon";
  255.  
  256.    /* enhancements */
  257.    case THING_BLUECARD:
  258.       return "Blue KeyCard";
  259.    case THING_YELLOWCARD:
  260.       return "Yellow KeyCard";
  261.    case THING_REDCARD:
  262.       return "Red KeyCard";
  263.    case THING_BLUESKULLKEY:
  264.       return "Blue Skull Key";
  265.    case THING_YELLOWSKULLKEY:
  266.       return "Yellow Skull Key";
  267.    case THING_REDSKULLKEY:
  268.       return "Red Skull Key";
  269.    case THING_ARMBONUS1:
  270.       return "Armour Helmet";
  271.    case THING_HLTBONUS1:
  272.       return "Health Potion";
  273.    case THING_GREENARMOR:
  274.       return "Green Armour";
  275.    case THING_BLUEARMOR:
  276.       return "Blue Armour";
  277.    case THING_SOULSPHERE:
  278.       return "Soul Sphere";
  279.    case THING_MEDKIT:
  280.       return "Medical Kit";
  281.    case THING_STIMPACK:
  282.       return "Stim Pack";
  283.    case THING_RADSUIT:
  284.       return "Radiation Suit";
  285.    case THING_MAP:
  286.       return "Computer Map";
  287.    case THING_BLURSPHERE:
  288.       return "Blur Sphere";
  289.    case THING_BESERK:
  290.       return "Beserk Sphere";
  291.    case THING_INVULN:
  292.       return "Invulnerability";
  293.    case THING_LITEAMP:
  294.       return "Lite Amp. Goggles";
  295.  
  296.    /* weapons */
  297.    case THING_SHOTGUN:
  298.       return "Shotgun";
  299.    case THING_CHAINSAW:
  300.       return "Chainsaw";
  301.    case THING_CHAINGUN:
  302.       return "Chaingun";
  303.    case THING_LAUNCHER:
  304.       return "Rocket Launcher";
  305.    case THING_PLASMAGUN:
  306.       return "Plasma Gun";
  307.    case THING_BFG9000:
  308.       return "BFG9000";
  309.    case THING_AMMOCLIP:
  310.       return "Ammo Clip";
  311.    case THING_AMMOBOX:
  312.       return "Box of Ammo";
  313.    case THING_SHELLS:
  314.       return "Shells";
  315.    case THING_SHELLBOX:
  316.       return "Box of Shells";
  317.    case THING_ROCKET:
  318.       return "Rocket";
  319.    case THING_ROCKETBOX:
  320.       return "Box of Rockets";
  321.    case THING_ENERGYCELL:
  322.       return "Energy Cell";
  323.    case THING_ENERGYPACK:
  324.       return "Energy Pack";
  325.    case THING_BACKPACK:
  326.       return "Backpack";
  327.  
  328.    /* decorations */
  329.    case THING_BARREL:
  330.       return "Barrel";
  331.    case THING_TECHCOLUMN:
  332.       return "Technical Column";
  333.    case THING_TGREENPILLAR:
  334.       return "Tall Green Pillar";
  335.    case THING_TREDPILLAR:
  336.       return "Tall Red Pillar";
  337.    case THING_SGREENPILLAR:
  338.       return "Short Green Pillar";
  339.    case THING_SREDPILLAR:
  340.       return "Short Red Pillar";
  341.    case THING_PILLARHEART:
  342.       return "Pillar w/Heart";
  343.    case THING_PILLARSKULL:
  344.       return "Red Pillar w/Skull";
  345.    case THING_EYEINSYMBOL:
  346.       return "Eye in Symbol";
  347.    case THING_GREYTREE:
  348.       return "Grey Tree";
  349.    case THING_BROWNSTUB:
  350.       return "Brown Stub";
  351.    case THING_BROWNTREE:
  352.       return "Tall Brown Tree";
  353.  
  354.    case THING_LAMP:
  355.       return "Lamp";
  356.    case THING_CANDLE:
  357.       return "Candle";
  358.    case THING_CANDELABRA:
  359.       return "Candelabra";
  360.    case THING_TBLUETORCH:
  361.       return "Tall Blue Torch";
  362.    case THING_TGREENTORCH:
  363.       return "Tall Green Torch";
  364.    case THING_TREDTORCH:
  365.       return "Tall Red Torch";
  366.    case THING_SBLUETORCH:
  367.       return "Short Blue Torch";
  368.    case THING_SGREENTORCH:
  369.       return "Short Green Torch";
  370.    case THING_SREDTORCH:
  371.       return "Short Red Torch";
  372.  
  373.    case THING_DEADPLAYER:
  374.       return "Dead Player (Green)";
  375.    case THING_DEADTROOPER:
  376.       return "Dead Trooper";
  377.    case THING_DEADSARGEANT:
  378.       return "Dead Sargeant";
  379.    case THING_DEADIMP:
  380.       return "Dead Imp";
  381.    case THING_DEADDEMON:
  382.       return "Dead Demon";
  383.    case THING_DEADCACODEMON:
  384.       return "Dead CacoDemon";
  385.    case THING_DEADLOSTSOUL:
  386.       return "Dead Lost Soul";
  387.    case THING_BONES:
  388.       return "Guts and Bones";
  389.    case THING_BONES2:
  390.       return "Guts and Bones 2";
  391.    case THING_POOLOFBLOOD:
  392.       return "Pool of Blood";
  393.    case THING_SKULLTOPPOLE:
  394.       return "Pole with Skull";
  395.    case THING_HEADSKEWER:
  396.       return "Skewer with Heads";
  397.    case THING_PILEOFSKULLS:
  398.       return "Pile of Skulls";
  399.    case THING_IMPALEDBODY:
  400.       return "Impaled body";
  401.    case THING_IMPALEDBODY2:
  402.       return "Twitching Impaled Body";
  403.    case THING_SKULLSINFLAMES:
  404.       return "Skulls in Flames";
  405.  
  406.    case THING_HANGINGSWAYING:
  407.       return "Swaying Body";
  408.    case THING_HANGINGARMSOUT:
  409.       return "Hanging Arms Out";
  410.    case THING_HANGINGONELEG:
  411.       return "One-legged Body";
  412.    case THING_HANGINGTORSO:
  413.       return "Hanging Torso";
  414.    case THING_HANGINGLEG:
  415.       return "Hanging Leg";
  416.    case THING_HANGINGSWAYING2:
  417.       return "Swaying Body 2";
  418.    case THING_HANGINGARMSOUT2:
  419.       return "Hanging Arms Out 2";
  420.    case THING_HANGINGONELEG2:
  421.       return "One-legged Body 2";
  422.    case THING_HANGINGTORSO2:
  423.       return "Hanging Torso 2";
  424.    case THING_HANGINGLEG2:
  425.       return "Hanging Leg 2";
  426.  
  427.    /* teleport */
  428.    case THING_TELEPORT:
  429.       return "Teleport exit";
  430.    }
  431.  
  432.    /* unknown */
  433.    sprintf( temp, "<UNKNOWN %04d>", type);
  434.    return temp;
  435. }
  436.  
  437.  
  438.  
  439. /*
  440.    get the size of a thing
  441. */
  442.  
  443. int GetThingRadius( int type)
  444. {
  445.    switch (type)
  446.    {
  447.    case THING_SPIDERBOSS:
  448.       return 128;
  449.    case THING_CYBERDEMON:
  450.       return 40;
  451.    case THING_BROWNTREE:
  452.       return 32;
  453.    case THING_CACODEMON:
  454.       return 31;
  455.    case THING_DEMON:
  456.    case THING_SPECTOR:
  457.       return 30;
  458.    case THING_BARON:
  459.       return 24;
  460.    case THING_SARGEANT:
  461.    case THING_TROOPER:
  462.    case THING_IMP:
  463.    case THING_BLUECARD:
  464.    case THING_YELLOWCARD:
  465.    case THING_REDCARD:
  466.    case THING_BLUESKULLKEY:
  467.    case THING_YELLOWSKULLKEY:
  468.    case THING_REDSKULLKEY:
  469.    case THING_ARMBONUS1:
  470.    case THING_HLTBONUS1:
  471.    case THING_GREENARMOR:
  472.    case THING_BLUEARMOR:
  473.    case THING_SOULSPHERE:
  474.    case THING_MEDKIT:
  475.    case THING_STIMPACK:
  476.    case THING_RADSUIT:
  477.    case THING_MAP:
  478.    case THING_BLURSPHERE:
  479.    case THING_BESERK:
  480.    case THING_INVULN:
  481.    case THING_LITEAMP:
  482.    case THING_SHOTGUN:
  483.    case THING_CHAINSAW:
  484.    case THING_CHAINGUN:
  485.    case THING_LAUNCHER:
  486.    case THING_PLASMAGUN:
  487.    case THING_BFG9000:
  488.    case THING_AMMOCLIP:
  489.    case THING_AMMOBOX:
  490.    case THING_SHELLS:
  491.    case THING_SHELLBOX:
  492.    case THING_ROCKET:
  493.    case THING_ROCKETBOX:
  494.    case THING_ENERGYCELL:
  495.    case THING_ENERGYPACK:
  496.    case THING_BACKPACK:
  497.       return 20;
  498.    case THING_BARREL:
  499.       return 10;
  500.    default:
  501.       return 16;
  502.    }
  503. }
  504.  
  505.  
  506. /*
  507.    get the name of the angle
  508. */
  509.  
  510. char *GetAngleName( int angle)
  511. {
  512.    switch (angle)
  513.    {
  514.    case 0:
  515.       return "East";
  516.    case 45:
  517.       return "NorthEast";
  518.    case 90:
  519.       return "North";
  520.    case 135:
  521.       return "NorthWest";
  522.    case 180:
  523.       return "West";
  524.    case 225:
  525.       return "SouthWest";
  526.    case 270:
  527.       return "South";
  528.    case 315:
  529.       return "SouthEast";
  530.    }
  531.    return "<ILLEGAL ANGLE>";
  532. }
  533.  
  534.  
  535.  
  536. /*
  537.    get string of when something will appear
  538. */
  539.  
  540. char *GetWhenName( int when)
  541. {
  542.    static char temp[ 40];
  543.  
  544.    temp[ 0] = '\0';
  545.    if (when & 0x01)
  546.       strcat( temp, "D12 ");
  547.    if (when & 0x02)
  548.       strcat( temp, "D3 ");
  549.    if (when & 0x04)
  550.       strcat( temp, "D45 ");
  551.    if (when & 0x08)
  552.       strcat( temp, "Deaf ");
  553.    if (when & 0x10)
  554.       strcat( temp, "Multi ");
  555.    return temp;
  556. }
  557.  
  558.  
  559.  
  560. /* end of file */
  561.