/[enigma]/enigma/src/oxyd.cc
ViewVC logotype

Diff of /enigma/src/oxyd.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by mhawlisch, Thu Mar 27 12:05:56 2003 UTC revision 1.9 by dheck, Thu Mar 27 18:12:27 2003 UTC
# Line 66  namespace Line 66  namespace
66          LevelInfo *get_info (size_t index);          LevelInfo *get_info (size_t index);
67      private:      private:
68          // Private methods          // Private methods
69            void set_item (const Level &level, int x, int y);
70    
71    
72          void load_floor (const Level &level);          void load_floor (const Level &level);
73          void load_items (const Level &level);          void load_items (const Level &level);
74          void load_stones (const Level &level);          void load_stones (const Level &level);
# Line 216  char *LevelPack_Oxyd::item_map[256] = { Line 219  char *LevelPack_Oxyd::item_map[256] = {
219      0,                          // 0x1e      0,                          // 0x1e
220      0,                          // 0x1f      0,                          // 0x1f
221      0,                          // 0x20      0,                          // 0x20
222      0,                          // 0x21      "it-spade",                 // 0x21
223      0,                          // 0x22      0,                          // 0x22
224      0,                          // 0x23      0,                          // 0x23
225      0,                          // 0x24      "it-seed",                  // 0x24
226      0,                          // 0x25      "it-spring2",               // 0x25
227      0,                          // 0x26      "it-spring1",               // 0x26
228      0,                          // 0x27      0,                          // 0x27
229      "it-magnet",                // 0x28      "it-magnet",                // 0x28
230      0,                          // 0x29      0,                          // 0x29
# Line 323  char *LevelPack_Oxyd::stone_map[256] = { Line 326  char *LevelPack_Oxyd::stone_map[256] = {
326      0,                          // 0x25      0,                          // 0x25
327      0,                          // 0x26      0,                          // 0x26
328      "st-wood",                  // 0x27      "st-wood",                  // 0x27
329      0,                          // 0x28      "st-switch",                // 0x28
330      0,                          // 0x29      0,                          // 0x29
331      0,                          // 0x2a      0,                          // 0x2a
332      0,                          // 0x2b      0,                          // 0x2b
333      0,                          // 0x2c      0,                          // 0x2c
334      0,                          // 0x2d      "st-floppy",                // 0x2d
335      0,                          // 0x2e      0,                          // 0x2e
336      "st-death",                 // 0x2f      "st-death",                 // 0x2f
337      "st-death_invisible",       // 0x30      "st-death_invisible",       // 0x30
# Line 384  char *LevelPack_Oxyd::stone_map[256] = { Line 387  char *LevelPack_Oxyd::stone_map[256] = {
387      0,                          // 0x62      0,                          // 0x62
388      0,                          // 0x63      0,                          // 0x63
389      0,                          // 0x64      0,                          // 0x64
390      0,                          // 0x65      "st-thief",                 // 0x65
391      0,                          // 0x66      0,                          // 0x66
392      0,                          // 0x67      0,                          // 0x67
393      0,                          // 0x68      0,                          // 0x68
# Line 434  char *LevelPack_Oxyd::stone_map[256] = { Line 437  char *LevelPack_Oxyd::stone_map[256] = {
437      0,                          // 0x94      0,                          // 0x94
438      0,                          // 0x95      0,                          // 0x95
439      "st-rubberband",            // 0x96      "st-rubberband",            // 0x96
440      0,                          // 0x97      "st-scissors",              // 0x97
441      0,                          // 0x98      0,                          // 0x98
442      0,                          // 0x99      0,                          // 0x99
443      "st-grate1",                // 0x9a  (XXX)      "st-grate1",                // 0x9a  (XXX)
# Line 475  LevelPack_Oxyd::load_floor (const Level Line 478  LevelPack_Oxyd::load_floor (const Level
478  }  }
479    
480  void  void
481  LevelPack_Oxyd::load_items (const Level &level)  LevelPack_Oxyd::set_item (const Level &level, int x, int y)
482  {  {
483      using namespace world;      using namespace world;
484    
485        Item *it = 0;
486      const Grid &grid = level.getGrid (GridType_Objects);      const Grid &grid = level.getGrid (GridType_Objects);
487      for (unsigned y=0; y<grid.getHeight(); ++y) {      int type = grid.get(x,y);
488          for (unsigned x=0; x<grid.getWidth(); ++x) {      switch (type) {
489              int val = grid.get(x,y);      case 0x00: break;           // ignore
490              if (!val) continue;      case 0x02:                  // note 1
491              const char *name = item_map[val];          it = MakeItem ("it-document");
492              Item *it = MakeItem (name ? name : "it-dummy");          it->set_attrib ("text", Value(level.getNoteText(0, Language_English).c_str()));
493              SetItem (GridPos(x, y), it);          break;
494        case 0x03:                  // note 2
495            it = MakeItem ("it-document");
496            it->set_attrib ("text", Value(level.getNoteText(1, Language_English).c_str()));
497            break;
498        default:
499            {
500                const char *name = item_map[type];
501                it = MakeItem (name ? name : "it-dummy");
502          }          }
503      }      }
504        if (it)
505            SetItem (GridPos(x, y), it);
506    }
507    
508    void
509    LevelPack_Oxyd::load_items (const Level &level)
510    {
511        const Grid &grid = level.getGrid (GridType_Objects);
512        for (unsigned y=0; y<grid.getHeight(); ++y)
513            for (unsigned x=0; x<grid.getWidth(); ++x)
514                set_item (level, x, y);
515  }  }
516    
517  void  void

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26