Changeset 1416


Ignore:
Timestamp:
May 29, 2012, 9:23:17 AM (8 years ago)
Author:
sam
Message:

orbital: parser for the gun commands... fails to link because of flex.

Location:
trunk/orbital
Files:
6 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/orbital/Makefile.am

    r1415 r1416  
    55    orbital.cpp orbital.h \
    66    mesh.cpp mesh.h \
     7    gun.cpp gun.h \
    78    particlesystem.h tank.h player.h gun.h snake.h starfield.h
    89nodist_orbital_SOURCES = \
     
    1314orbital_DEPENDENCIES = $(top_builddir)/src/liblol.a \
    1415    generated/mesh-scanner.cpp \
    15     generated/mesh-parser.cpp
     16    generated/mesh-parser.cpp \
     17    generated/gun-scanner.cpp \
     18    generated/gun-parser.cpp
    1619
    1720all-local: orbital$(EXEEXT)
     
    2326        flex -o generated/mesh-scanner.cpp mesh.l
    2427        bison -o generated/mesh-parser.cpp -d -b generated/mesh mesh.yy
     28        flex -o generated/gun-scanner.cpp gun.l
     29        bison -o generated/gun-parser.cpp -d -b generated/gun gun.yy
    2530.FORCE:
    2631endif
  • trunk/orbital/gun.h

    r1396 r1416  
    55//
    66
    7 /* TODO for this file:
    8  *  - rename "AppendQuadVert" to "AddVertex" or something; it has nothing
    9  *    to do with quads.
    10  */
    11 
    127extern char const *lolfx_shiny;
    13 
    14 #include "CommandParser.h"
    158
    169#if !defined __GUN_H__
    1710#define __GUN_H__
    1811
    19 class Gun : public CommandParser
     12namespace yy { class GunParser; }
     13
     14class Gun
    2015{
     16    friend class yy::GunParser;
     17
    2118public:
    2219    Gun()
     
    3734    {}
    3835
    39     virtual void SwitchCommand(char const *&command)
    40     {
    41         vec4 v4;
    42         vec3 v3;
    43         float f1, f2, f3, f4, f5, f6, f7, f8;
    44 
    45         const char *&p = command;
    46         {
    47 #define CASE(str) if (CheckCommand(str, p))
    48                  CASE("ai") { m_angle = AimActor(); }
    49             else CASE("pai") { p = GetArg(p, f1); PreAimActor(f1); }
    50             else CASE("ca") { p = GetArg(p, f1); m_pre_aim = f1; }
    51             else CASE("sa") { p = GetArg(p, f1); m_angle = f1; }
    52             else CASE("tim") { p = GetArg(p, f1); m_round_duration = f1; }
    53             else CASE("so") { p = GetArg(p, f1); m_angle_offset = f1; }
    54             else CASE("rd") { p = GetArg(p, f1); m_radius = f1; }
    55             else CASE("spd") { p = GetArg(p, f1); m_shoot_speed = f1; }
    56             else CASE("moda") { p = GetArg(p, v3); /* FIXME: 1st modifier */ }
    57             else CASE("modb") { p = GetArg(p, v3); /* FIXME: 2nd modifier */ }
    58             else CASE("ffb") { p = GetArg(p, f1); for (int i = 0; i < (int)f1; i++) Shoot(1); m_shoot_type = 1; m_round_timer = m_round_duration; }
    59             else CASE("ffp") { p = GetArg(p, f1); for (int i = 0; i < (int)f1; i++) Shoot(0); m_shoot_type = 0; m_round_timer = m_round_duration; }
    60             else CASE("fb") { p = GetArg(p, f1); Shoot(1); m_nbshoots = (int)f1 - 1; m_shoot_type = 1; m_round_timer = m_round_duration; }
    61             else CASE("fp") { p = GetArg(p, f1); Shoot(0); m_nbshoots = (int)f1 - 1; m_shoot_type = 0; m_round_timer = m_round_duration; }
    62             else CASE("sk") { p = GetArg(p, f1); m_round_timer = m_round_duration * f1; /* FIXME: modifiers */ }
    63             else CASE("loop") { /* FIXME: loops */ }
    64 #undef CASE
    65         }
    66     }
     36    void SendCommand(char const *command);
    6737
    6838    void Shoot(int count)
Note: See TracChangeset for help on using the changeset viewer.