Changeset 686


Ignore:
Timestamp:
Jul 30, 2013, 4:20:28 PM (9 years ago)
Author:
Sam Hocevar
Message:

build: port everything to the current Lol Engine API.

Location:
abuse/branches/lol
Files:
4 deleted
35 edited

Legend:

Unmodified
Added
Removed
  • abuse/branches/lol/.gitignore

    r610 r686  
    1414.auto
    1515.deps
     16.dirstamp
    1617src/abuse
    1718src/abuse-tool
  • abuse/branches/lol/Makefile.am

    r622 r686  
    1 ## Process this file with automake to produce Makefile.in
     1
     2include $(top_srcdir)/build/autotools/common.am
    23
    34SUBDIRS = src data doc
    45
    5 EXTRA_DIST = COPYING.GPL COPYING.WTFPL PACKAGERS bootstrap
     6EXTRA_DIST += COPYING.GPL COPYING.WTFPL PACKAGERS bootstrap
    67
    78dist-hook:
  • abuse/branches/lol/doc/Makefile.am

    r624 r686  
    22man_MANS = abuse.6 abuse-tool.6
    33
     4assetdir = $(sharedir)/asset
    45asset_DATA = abuse.bmp abuse.png
    56
  • abuse/branches/lol/src/Makefile.am

    r651 r686  
    77abuse_SOURCES = \
    88    common.h \
    9     \
    10     lol/matrix.cpp lol/matrix.h \
    11     lol/timer.cpp lol/timer.h \
    129    \
    1310    specache.cpp specache.h \
     
    6663
    6764EXTRALIBS = lisp/liblisp.a sdlport/libsdlport.a imlib/libimlib.a net/libnet.a
    68 abuse_LDADD = $(EXTRALIBS)
     65abuse_LDADD = $(EXTRALIBS) $(LOL_LIBS)
    6966abuse_DEPENDENCIES = $(EXTRALIBS)
    7067
  • abuse/branches/lol/src/ant.cpp

    r682 r686  
    5858  for (game_object *d=current_level->first_active_object(); d; d=d->next_active)
    5959  {
    60     if (d->otype==o->otype && abs(o->x-d->x)<30 && abs(o->x-d->y)<20) return 1;
     60    if (d->otype==o->otype && lol::abs(o->x-d->x)<30 && lol::abs(o->x-d->y)<20) return 1;
    6161  }
    6262  return 0;
     
    174174      b=current_level->attacker(current_object);
    175175    else b=player_list->m_focus;
    176     if (abs(b->x-o->x)<130 && (o->y<b->y))
     176    if (lol::abs(b->x-o->x)<130 && (o->y<b->y))
    177177      fall=1;
    178178      }
     
    206206        b=current_level->attacker(current_object);
    207207      else b=player_list->m_focus;
    208       if (abs(b->x-o->x)<130 && (o->y<b->y))
     208      if (lol::abs(b->x-o->x)<130 && (o->y<b->y))
    209209      fall=1;
    210210    }
     
    269269    {
    270270      o->next_picture();
    271       if ((jrand()%4)==0 && abs(o->x-b->x)<180 && abs(o->y-b->y)<100 && can_hit_player(o,b))
     271      if ((jrand()%4)==0 && lol::abs(o->x-b->x)<180 && lol::abs(o->y-b->y)<100 && can_hit_player(o,b))
    272272      {
    273273        o->set_state((character_state)S_weapon_fire);
    274274        o->set_aistate(ANT_FIRE);
    275       } else if (abs(o->x-b->x)<100 && abs(o->y-b->y)<10 && (jrand()%4)==0)
     275      } else if (lol::abs(o->x-b->x)<100 && lol::abs(o->y-b->y)<10 && (jrand()%4)==0)
    276276        o->set_aistate(ANT_POUNCE_WAIT);
    277       else if (abs(o->x-b->x)>140 && !ant_congestion(o))
     277      else if (lol::abs(o->x-b->x)>140 && !ant_congestion(o))
    278278        o->set_aistate(ANT_JUMP);
    279279      else
     
    287287        {
    288288          new_xm=xm;
    289           ym=-abs(xm);
     289          ym=-lol::abs(xm);
    290290          o->try_move(o->x,o->y,new_xm,ym,3);
    291291          if (new_xm==xm)
     
    294294        o->y+=ym;
    295295        new_xm=0;
    296         ym=abs(xm);      // now get back on the ground
     296        ym=lol::abs(xm);      // now get back on the ground
    297297        o->try_move(o->x,o->y,new_xm,ym,3);
    298298        o->x+=new_xm;
     
    388388      else b=player_list->m_focus;
    389389      scream_check(o,b);
    390       if (((jrand()%8)==0 && abs(o->x-b->x)<10 && o->y<b->y) ||
     390      if (((jrand()%8)==0 && lol::abs(o->x-b->x)<10 && o->y<b->y) ||
    391391      o->lvars[ANT_need_to_dodge]==1)
    392392      {
     
    400400    if ((o->x>b->x && o->direction>0) || (o->x<b->x && o->direction<0))
    401401    o->direction=-o->direction;
    402     else if (abs(o->x-b->x)<120 && (jrand()%4)==0)
     402    else if (lol::abs(o->x-b->x)<120 && (jrand()%4)==0)
    403403    {
    404404      o->set_state((character_state)S_ceil_fire);
     
    484484    wm->font()->PutString(main_screen, ivec2(x, y), msg, wm->bright_color());
    485485    wm->flush_screen();
    486     Timer now; now.WaitMs(500);
    487   }
    488 }
    489 
     486    Timer now; now.Wait(0.5);
     487  }
     488}
     489
  • abuse/branches/lol/src/clisp.cpp

    r682 r686  
    10491049        case 1:
    10501050        {
    1051             return abs(current_object->x-current_level->attacker(current_object)->x);
     1051            return lol::abs(current_object->x-current_level->attacker(current_object)->x);
    10521052        } break;
    10531053        case 2:
    10541054        {
    1055             return abs(current_object->y-current_level->attacker(current_object)->y);
     1055            return lol::abs(current_object->y-current_level->attacker(current_object)->y);
    10561056        } break;
    10571057        case 3:
  • abuse/branches/lol/src/common.h

    r682 r686  
    2121// Lol Engine
    2222//
    23 #include "lol/matrix.h"
    24 #include "lol/timer.h"
     23#include "core.h"
    2524using namespace lol;
    2625
  • abuse/branches/lol/src/cop.cpp

    r682 r686  
    175175
    176176    // if the pointer is too close to the player go with the angle shown, not the angle through the pointer
    177     if (abs(q->y-fb[1]-v->pointer_y)<45 && abs(v->pointer_x-q->x+fb[0])<40)
     177    if (lol::abs(q->y-fb[1]-v->pointer_y)<45 && lol::abs(v->pointer_x-q->x+fb[0])<40)
    178178      o->lvars[point_angle]=lisp_atan2(fb[1]-iy,fb[0]-ix);
    179179    else
     
    390390      for (p=current_level->first_active_object(); p; p=p->next_active)
    391391      {
    392         xd=abs(p->x-o->x);
    393         yd=abs(p->y-o->y);
     392        xd=lol::abs(p->x-o->x);
     393        yd=lol::abs(p->y-o->y);
    394394        if (xd<160 && yd<130 && bad_guy_array[p->otype] && p!=other)
    395395        {
     
    10881088
    10891089  wm->flush_screen();
    1090   Timer now; now.WaitMs(4000);   // wait 4 seconds
     1090  Timer now; now.Wait(4.f);   // wait 4 seconds
    10911091
    10921092  return NULL;
  • abuse/branches/lol/src/demo.cpp

    r682 r686  
    205205/*
    206206      fade_in(cache.img(cache.reg("art/help.spe","sell6",SPEC_IMAGE,1)),8);
    207       Timer now; now.WaitMs(2000);
     207      Timer now; now.Wait(2.f);
    208208      fade_out(8);
    209209*/
  • abuse/branches/lol/src/dev.cpp

    r682 r686  
    15561556      ivec2 pos1 = the_game->GameToMouse(ivec2(a->x, a->y), v);
    15571557      ivec2 pos2 = the_game->GameToMouse(ivec2(a->x + a->w, a->y + a->h), v);
    1558       if (abs(pos1.x - m.x) < 2 && abs(pos1.y - m.y) < 2)
     1558      if (lol::abs(pos1.x - m.x) < 2 && lol::abs(pos1.y - m.y) < 2)
    15591559      { find = a; find_top = 1; }
    1560       else if (abs(pos2.x - m.x) < 2 && abs(pos2.y - m.y) < 2)
     1560      else if (lol::abs(pos2.x - m.x) < 2 && lol::abs(pos2.y - m.y) < 2)
    15611561      { find = a; find_top = 0; }
    15621562    }
  • abuse/branches/lol/src/endgame.cpp

    r682 r686  
    7272      *(lrem++)=*(sl_start++);
    7373/*      if (x==size/2 || x==size/2-1 || x==size/2+1)
    74         *rem=(int)(sqrt(0.5)*map_width/2.0);
     74        *rem=(int)(lol::sqrt(0.5)*map_width/2.0);
    7575      else*/
    7676      if (x<=size/2)
    77         *rem=(int)(sqrt(x/(double)(size*2.0))*map_width/2.0);
     77        *rem=(int)(lol::sqrt(x/(double)(size*2.0))*map_width/2.0);
    7878      else
    79         *rem=map_width/2-(int)(sqrt((size-x)/(double)(size*2.0))*map_width/2.0);
    80 
    81 //      (int)(mask->Size().x-(sqrt((size-x)/(double)size)*map_width/2.0)+mask->Size().x/2);
     79        *rem=map_width/2-(int)(lol::sqrt((size-x)/(double)(size*2.0))*map_width/2.0);
     80
     81//      (int)(mask->Size().x-(lol::sqrt((size-x)/(double)size)*map_width/2.0)+mask->Size().x/2);
    8282    }
    8383  }
  • abuse/branches/lol/src/game.cpp

    r682 r686  
    148148            continue;
    149149
    150         int d, cx = abs(f->x_center() - x), cy = abs(f->y_center() - y);
     150        int d, cx = lol::abs(f->x_center() - x), cy = lol::abs(f->y_center() - y);
    151151        if(cx < cy)
    152152            d = cx + cy - (cx >> 1);
     
    10791079{
    10801080    /* 25ms per step */
    1081     float const duration = 25.f;
     1081    float const duration = 0.025f;
    10821082
    10831083    palette *old_pal = pal->copy();
     
    10901090    }
    10911091
    1092     for (Timer total; total.PollMs() < duration * steps; )
     1092    for (Timer total; total.Poll() < duration * steps; )
    10931093    {
    10941094        Timer frame;
    10951095        uint8_t *sl1 = (uint8_t *)pal->addr();
    10961096        uint8_t *sl2 = (uint8_t *)old_pal->addr();
    1097         int i = (int)(total.PollMs() / duration);
     1097        int i = (int)(total.Poll() / duration);
    10981098        int v = (N ? i + 1 : steps - i) * 256 / steps;
    10991099
     
    11031103        pal->load();
    11041104        wm->flush_screen();
    1105         frame.WaitMs(duration);
     1105        frame.Wait(duration);
    11061106    }
    11071107
     
    11581158    delete blank;
    11591159    fade_in(cache.img(cdc_logo), 32);
    1160     Timer tmp; tmp.WaitMs(400);
     1160    Timer tmp; tmp.Wait(0.4f);
    11611161    fade_out(32);
    11621162
     
    12031203
    12041204            // 120 ms per step
    1205             int i = (int)(total.PollMs() / 120.f);
     1205            int i = (int)(total.Poll() / 0.120f);
    12061206            if (i >= 400)
    12071207                break;
     
    12191219                cache.sfx(lnumber_value(space_snd))->play(sfx_volume * 90 / 127);
    12201220
    1221             frame.WaitMs(25.f);
    1222             frame.GetMs();
     1221            frame.Wait(0.025f);
     1222            frame.Get();
    12231223        }
    12241224
     
    14141414
    14151415time_marker *led_last_time = NULL;
    1416 static float avg_ms = 1000.0f / 15, possible_ms = 1000.0f / 15;
     1416static float avg_time = 1.0f / 15, possible_time = 1.0f / 15;
    14171417
    14181418void Game::toggle_delay()
     
    14201420    no_delay = !no_delay;
    14211421    show_help(symbol_str(no_delay ? "delay_off" : "delay_on"));
    1422     avg_ms = possible_ms = 1000.0f / 15;
     1422    avg_time = possible_time = 1.0f / 15;
    14231423}
    14241424
     
    14291429
    14301430    char str[16];
    1431     sprintf(str, "%ld", (long)(10000.0f / avg_ms));
     1431    sprintf(str, "%ld", (long)(1.0f / avg_time));
    14321432    console_font->PutString(main_screen, first_view->m_aa, str);
    14331433
     
    15101510
    15111511    // Find average fps for last 10 frames
    1512     float deltams = Max(1.0f, frame_timer.PollMs());
    1513 
    1514     avg_ms = 0.9f * avg_ms + 0.1f * deltams;
    1515     possible_ms = 0.9f * possible_ms + 0.1f * deltams;
    1516 
    1517     if (avg_ms < 1000.0f / 14)
     1512    float deltatime = Max(0.001f, frame_timer.Poll());
     1513
     1514    avg_time = 0.9f * avg_time + 0.1f * deltatime;
     1515    possible_time = 0.9f * possible_time + 0.1f * deltatime;
     1516
     1517    if (avg_time < 1.0f / 14)
    15181518        massive_frame_panic = Max(0, Min(20, massive_frame_panic - 1));
    15191519
     
    15241524        // ECS - Added this case and the wait.  It's a cheap hack to ensure
    15251525        // that we don't exceed 30FPS in edit mode and hog the CPU.
    1526         frame_timer.WaitMs(33);
    1527     }
    1528     else if (avg_ms < 1000.0f / 15 && need_delay)
     1526        frame_timer.Wait(0.033f);
     1527    }
     1528    else if (avg_time < 1.0f / 15 && need_delay)
    15291529    {
    15301530        frame_panic = 0;
    15311531        if (!no_delay)
    15321532        {
    1533             frame_timer.WaitMs(1000.0f / 15);
    1534             avg_ms -= 0.1f * deltams;
    1535             avg_ms += 0.1f * 1000.0f / 15;
     1533            frame_timer.Wait(1.0f / 15);
     1534            avg_time -= 0.1f * deltatime;
     1535            avg_time += 0.1f * 1.0f / 15;
    15361536        }
    15371537    }
    1538     else if (avg_ms > 1000.0f / 14)
    1539     {
    1540         if(avg_ms > 1000.0f / 10)
     1538    else if (avg_time > 1.0f / 14)
     1539    {
     1540        if(avg_time > 1.0f / 10)
    15411541            massive_frame_panic++;
    15421542        frame_panic++;
     
    15461546
    15471547    // Ignore our wait time, we're more interested in the frame time
    1548     frame_timer.GetMs();
     1548    frame_timer.Get();
    15491549    return ret;
    15501550}
     
    24412441        delete chat;
    24422442
    2443         Timer tmp; tmp.WaitMs(500);
     2443        Timer tmp; tmp.Wait(0.5f);
    24442444
    24452445        delete small_render; small_render = NULL;
  • abuse/branches/lol/src/gamma.cpp

    r682 r686  
    216216        uint8_t oldr, oldg, oldb;
    217217        old_pal->get(i, oldr, oldg, oldb);
    218         pal->set(i, (int)(pow(oldr / 255.0, gamma) * 255),
    219             (int)(pow(oldg / 255.0, gamma) * 255),
    220             (int)(pow(oldb / 255.0, gamma) * 255));
     218        pal->set(i, (int)(lol::pow(oldr / 255.0, gamma) * 255),
     219            (int)(lol::pow(oldg / 255.0, gamma) * 255),
     220            (int)(lol::pow(oldb / 255.0, gamma) * 255));
    221221    }
    222222
  • abuse/branches/lol/src/go.cpp

    r555 r686  
    155155    {
    156156      int yd=o[i]->y-y;
    157       if (abs(yd)<=speed && o[i]->x>x1 && o[i]->x<x2)
     157      if (lol::abs(yd)<=speed && o[i]->x>x1 && o[i]->x<x2)
    158158        return (elcontrol *)(o[i]);
    159159    }
     
    167167int elevator::decide()
    168168{
    169   if (abs(dir)<=1)                                  // the elevator is stopped
     169  if (lol::abs(dir)<=1)                                  // the elevator is stopped
    170170  {
    171171    switch (state)
     
    222222  }
    223223
    224   if (abs(dir)>1)                     // are we moving?
     224  if (lol::abs(dir)>1)                     // are we moving?
    225225  {
    226226    next_picture();
     
    230230    else adder=speed;
    231231
    232     if (abs(dir)==8)                   // are we checking for stops yet?
     232    if (lol::abs(dir)==8)                   // are we checking for stops yet?
    233233    {
    234234      elcontrol *s=find_stop();
  • abuse/branches/lol/src/imlib/event.cpp

    r682 r686  
    6060    f.Apply(im);
    6161
    62     m_sprite = new Sprite(screen, im, ivec2(100, 100));
     62    m_sprite = new ASprite(screen, im, ivec2(100, 100));
    6363    m_pos = screen->Size() / 2;
    6464    m_center = ivec2(0, 0);
     
    8686
    8787        if (!m_pending)
    88             tmp.WaitMs(1);
     88            tmp.Wait(0.001);
    8989    }
    9090
  • abuse/branches/lol/src/imlib/event.h

    r682 r686  
    9898protected:
    9999    /* Mouse information */
    100     Sprite *m_sprite;
     100    ASprite *m_sprite;
    101101    ivec2 m_pos, m_center;
    102102    int m_button;
  • abuse/branches/lol/src/imlib/filter.cpp

    r682 r686  
    8888        return;
    8989
    90     aa += Max(caa - pos, 0);
     90    aa += Max(caa - pos, ivec2(0));
    9191    pos = Max(pos, caa);
    9292    bb = Min(bb, cbb - pos + aa);
  • abuse/branches/lol/src/imlib/image.cpp

    r682 r686  
    222222    int xi = (span.x < 0) ? -1 : 1;
    223223    int yi = (span.y < 0) ? -1 : 1;
    224     int n = abs(span.x);
    225     int m = abs(span.y);
     224    int n = lol::abs(span.x);
     225    int m = lol::abs(span.y);
    226226
    227227    uint8_t *start = scan_line(p1.y) + p1.x;
     
    317317    // with no dirty rectangle keeping.
    318318    if (!m_special)
    319         m_special = new image_descriptor(m_size.x, m_size.y, 0);
     319        m_special = new image_descriptor(m_size, 0);
    320320
    321321    // set the image descriptor what the clip
     
    351351   // with no dirty rectangle keeping.
    352352   if (!m_special)
    353        m_special = new image_descriptor(m_size.x, m_size.y, 0);
     353       m_special = new image_descriptor(m_size, 0);
    354354
    355355   // set the image descriptor what the clip
     
    735735    x1=Max(x1, caa.x); y1=Max(caa.y, y1); x2=Min(x2, cbb.x - 1); y2=Min(y2, cbb.y - 1);
    736736  }
    737   int16_t xsrc, ysrc, xdst, ydst, xtot=x2-x1-abs(xd)+1, ytot, xt;
     737  int16_t xsrc, ysrc, xdst, ydst, xtot=x2-x1-lol::abs(xd)+1, ytot, xt;
    738738  uint8_t *src, *dst;
    739739  if (xd<0) { xsrc=x1-xd; xdst=x1; } else { xsrc=x2-xd; xdst=x2; }
    740740  if (yd<0) { ysrc=y1-yd; ydst=y1; } else { ysrc=y2-yd; ydst=y2; }
    741   for (ytot=y2-y1-abs(yd)+1; ytot; ytot--)
     741  for (ytot=y2-y1-lol::abs(yd)+1; ytot; ytot--)
    742742  { src=scan_line(ysrc)+xsrc;
    743743    dst=scan_line(ydst)+xdst;
  • abuse/branches/lol/src/imlib/jwindow.cpp

    r682 r686  
    374374Jwindow::Jwindow(ivec2 pos, ivec2 size, ifield *f, char const *name)
    375375{
    376     m_size = 0;
     376    m_size = ivec2(0);
    377377    _hidden = false;
    378378    _moveable = true;
  • abuse/branches/lol/src/imlib/palette.cpp

    r653 r686  
    128128    else
    129129    {
    130       v=(int) ((double)i+(double)(sqrt(63.0-i)));
     130      v=(int) ((double)i+(double)(lol::sqrt(63.0-i)));
    131131      v<<=2;
    132132    }
  • abuse/branches/lol/src/imlib/sprite.cpp

    r682 r686  
    2323#include "sprite.h"
    2424
    25 Sprite::Sprite(image *screen, image *visual, ivec2 pos)
     25ASprite::ASprite(image *screen, image *visual, ivec2 pos)
    2626{
    2727    CHECK(visual && screen);
     
    3131    m_save = new image(visual->Size());
    3232
    33     if (m_pos + visual->Size() >= 0 && m_pos < ivec2(xres, yres))
    34         m_save->PutPart(m_screen, ivec2(0,0), m_pos, m_pos + m_save->Size());
     33    if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres))
     34        m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size());
    3535}
    3636
    37 Sprite::~Sprite()
     37ASprite::~ASprite()
    3838{
    3939    delete m_save;
    4040}
    4141
    42 void Sprite::SetVisual(image *visual, int delete_old)
     42void ASprite::SetVisual(image *visual, int delete_old)
    4343{
    4444    if (delete_old)
     
    5151    }
    5252
    53     if (m_pos + visual->Size() >= 0 && m_pos < ivec2(xres, yres))
    54         m_save->PutPart(m_screen, ivec2(0,0), m_pos, m_pos + m_save->Size());
     53    if (m_pos + visual->Size() >= ivec2(0) && m_pos < ivec2(xres, yres))
     54        m_save->PutPart(m_screen, ivec2(0), m_pos, m_pos + m_save->Size());
    5555}
    5656
  • abuse/branches/lol/src/imlib/sprite.h

    r682 r686  
    1515#include "linked.h"
    1616
    17 class Sprite : public linked_node
     17class ASprite : public linked_node
    1818{
    1919public:
    20     Sprite(image *screen, image *visual, ivec2 pos);
    21     ~Sprite();
     20    ASprite(image *screen, image *visual, ivec2 pos);
     21    ~ASprite();
    2222
    2323    void SetVisual(image *visual, int delete_old = 0);
  • abuse/branches/lol/src/imlib/transimage.cpp

    r682 r686  
    277277void TransImage::PutImage(image *screen, ivec2 pos)
    278278{
    279     PutImageGeneric<NORMAL>(screen, pos, 0, NULL, 0, NULL, NULL,
     279    PutImageGeneric<NORMAL>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
    280280                            0, 1, NULL, NULL, NULL);
    281281}
     
    283283void TransImage::PutRemap(image *screen, ivec2 pos, uint8_t *map)
    284284{
    285     PutImageGeneric<REMAP>(screen, pos, 0, NULL, 0, map, NULL,
     285    PutImageGeneric<REMAP>(screen, pos, 0, NULL, ivec2(0), map, NULL,
    286286                           0, 1, NULL, NULL, NULL);
    287287}
     
    290290                            uint8_t *map, uint8_t *map2)
    291291{
    292     PutImageGeneric<REMAP2>(screen, pos, 0, NULL, 0, map, map2,
     292    PutImageGeneric<REMAP2>(screen, pos, 0, NULL, ivec2(0), map, map2,
    293293                            0, 1, NULL, NULL, NULL);
    294294}
     
    298298                         ColorFilter *f, palette *pal)
    299299{
    300     PutImageGeneric<FADE>(screen, pos, 0, NULL, 0, NULL, NULL,
     300    PutImageGeneric<FADE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
    301301                          amount, nframes, NULL, f, pal);
    302302}
     
    305305                             uint8_t *tint, ColorFilter *f, palette *pal)
    306306{
    307     PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, 0, NULL, NULL,
     307    PutImageGeneric<FADE_TINT>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
    308308                               amount, nframes, tint, f, pal);
    309309}
     
    311311void TransImage::PutColor(image *screen, ivec2 pos, uint8_t color)
    312312{
    313     PutImageGeneric<COLOR>(screen, pos, color, NULL, 0, NULL, NULL,
     313    PutImageGeneric<COLOR>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
    314314                           0, 1, NULL, NULL, NULL);
    315315}
     
    326326void TransImage::PutFilled(image *screen, ivec2 pos, uint8_t color)
    327327{
    328     PutImageGeneric<FILLED>(screen, pos, color, NULL, 0, NULL, NULL,
     328    PutImageGeneric<FILLED>(screen, pos, color, NULL, ivec2(0), NULL, NULL,
    329329                            0, 1, NULL, NULL, NULL);
    330330}
     
    332332void TransImage::PutPredator(image *screen, ivec2 pos)
    333333{
    334     PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, 0, NULL, NULL,
     334    PutImageGeneric<PREDATOR>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
    335335                              0, 1, NULL, NULL, NULL);
    336336}
     
    338338void TransImage::PutScanLine(image *screen, ivec2 pos, int line)
    339339{
    340     PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, 0, NULL, NULL,
     340    PutImageGeneric<SCANLINE>(screen, pos, 0, NULL, ivec2(0), NULL, NULL,
    341341                              line, 1, NULL, NULL, NULL);
    342342}
  • abuse/branches/lol/src/intsect.cpp

    r555 r686  
    1313#endif
    1414
     15#include "common.h"
     16
    1517#include <stdlib.h>
    1618
     
    121123        else
    122124        {
    123           if (abs(mx1)>abs(my1))
     125          if (lol::abs(mx1)>lol::abs(my1))
    124126          {
    125127            int32_t ae_bd=my1*mx2-mx1*my2;
     
    138140      }
    139141
    140       if (abs(tx2-x1)<abs(x2-x1) || abs(ty2-y1)<abs(y2-y1))
     142      if (lol::abs(tx2-x1)<lol::abs(x2-x1) || lol::abs(ty2-y1)<lol::abs(y2-y1))
    141143      {
    142144        x2=tx2;
     
    171173
    172174  int32_t xdiff,ydiff;
    173 /*  int32_t xdiff=abs(xp1-xp2),ydiff=yp1-yp2;
     175/*  int32_t xdiff=lol::abs(xp1-xp2),ydiff=yp1-yp2;
    174176  if (xdiff>=ydiff)                              // increment the endpoints
    175177    if (xp2<xp1) { xp2--; xp1++; }
     
    205207      x2=(b1*c2-b2*c1)/(ae-bd);
    206208      y2=(a1*c2-a2*c1)/(bd-ae);
    207       xdiff=abs(x2-x1);
    208       ydiff=abs(y2-y1);
     209      xdiff=lol::abs(x2-x1);
     210      ydiff=lol::abs(y2-y1);
    209211//      if (xdiff<=ydiff)            // push the intersection back one pixel
    210212//      {
  • abuse/branches/lol/src/lcache.cpp

    r636 r686  
    1818#   include "config.h"
    1919#endif
     20
     21#include "common.h"
    2022
    2123#include "lisp.h"
     
    122124
    123125            LList *last = NULL, *first = NULL;
    124             for (size_t count = abs(t); count--; )
     126            for (size_t count = lol::abs(t); count--; )
    125127            {
    126128                LList *c = LList::Create();
     
    134136
    135137            last = first;
    136             for (size_t count = abs(t); count--; last = (LList *)last->m_cdr)
     138            for (size_t count = lol::abs(t); count--; last = (LList *)last->m_cdr)
    137139                last->m_car = load_block(fp);
    138140            return first;
  • abuse/branches/lol/src/level.cpp

    r682 r686  
    5555    if (f->m_focus)
    5656    {
    57       int32_t tmp_d=abs(f->m_focus->x-who->x)+abs(f->m_focus->y-who->y);
     57      int32_t tmp_d=lol::abs(f->m_focus->x-who->x)+lol::abs(f->m_focus->y-who->y);
    5858      if (tmp_d<d)
    5959      {
     
    378378  {
    379379    int b1=subject->push_range(),b2=target->push_range();
    380     if (abs(subject->x-target->x)<b1+b2)
    381     {
    382       int32_t tmove=b1+b2-abs(subject->x-target->x),xv,yv=0,xv2;
     380    if (lol::abs(subject->x-target->x)<b1+b2)
     381    {
     382      int32_t tmove=b1+b2-lol::abs(subject->x-target->x),xv,yv=0,xv2;
    383383      if (subject->x>target->x)
    384384        xv=tmove/2;
     
    692692      else if (shutdown_lighting_value!=c->ambient) // do we need to lower light toward real ambient?
    693693      {
    694         if (abs(shutdown_lighting_value-c->ambient)<4)
     694        if (lol::abs(shutdown_lighting_value-c->ambient)<4)
    695695          shutdown_lighting_value=c->ambient;
    696696        else
     
    28892889    if (o->otype==type)
    28902890    {
    2891       int x_dist=abs(x-o->x);
    2892       int y_dist=abs(y-o->y);
     2891      int x_dist=lol::abs(x-o->x);
     2892      int y_dist=lol::abs(y-o->y);
    28932893
    28942894      if (x_dist<xd  && y_dist<find_ydist)
     
    29122912    if (o->otype==type && o!=who)
    29132913    {
    2914       int x_dist=abs(x-o->x);
     2914      int x_dist=lol::abs(x-o->x);
    29152915      if (x_dist<find_xdist)
    29162916      {
    29172917    find_xdist=x_dist;
    2918     find_ydist=abs(y-o->y);
     2918    find_ydist=lol::abs(y-o->y);
    29192919    find=o;
    29202920      }
    29212921      else if (x_dist==find_xdist)
    29222922      {
    2923     int y_dist=abs(y-o->y);
     2923    int y_dist=lol::abs(y-o->y);
    29242924    if (y_dist<find_ydist)
    29252925    {
     
    30003000    {
    30013001      int32_t y1=o->y,y2=o->y-o->picture()->Size().y;
    3002       int32_t cx=abs(o->x-x),cy1=abs(y1-y),d1,d2,cy2=abs(y2-y);
     3002      int32_t cx=lol::abs(o->x-x),cy1=lol::abs(y1-y),d1,d2,cy2=lol::abs(y2-y);
    30033003      if (cx<cy1)
    30043004        d1=cx+cy1-(cx>>1);
     
    30613061      if (v!=exclude)
    30623062      {
    3063     int32_t cx=abs(v->x_center()-o->x),cy=abs(v->y_center()-o->y),d;
     3063    int32_t cx=lol::abs(v->x_center()-o->x),cy=lol::abs(v->y_center()-o->y),d;
    30643064    if (cx<cy)
    30653065          d=cx+cy-(cx>>1);
     
    31723172      if (!NILP(v))
    31733173      {
    3174     xo=abs(o->x-x);
    3175     yo=abs(o->y-y);
     3174    xo=lol::abs(o->x-x);
     3175    yo=lol::abs(o->y-y);
    31763176    distance=xo*xo+yo*yo;
    31773177    if (distance<closest_distance)
     
    32073207      if (!NILP(v))
    32083208      {
    3209     xo=abs(o->x-x);
    3210     yo=abs(o->y-y);
     3209    xo=lol::abs(o->x-x);
     3210    yo=lol::abs(o->y-y);
    32113211    distance=xo*xo+yo*yo;
    32123212    if (distance<closest_distance)
  • abuse/branches/lol/src/light.cpp

    r682 r686  
    553553    else
    554554    {
    555       int32_t dx=abs(fn->x-x)<<fn->xshift;
    556       int32_t dy=abs(fn->y-y)<<fn->yshift;
     555      int32_t dx=lol::abs(fn->x-x)<<fn->xshift;
     556      int32_t dy=lol::abs(fn->y-y)<<fn->yshift;
    557557      int32_t  r2;
    558558      if (dx<dy)
     
    658658    {
    659659      dt++;
    660       dx=abs(*dt-sx); dt++;               // xdist between light and this block  (dt==x)
     660      dx=lol::abs(*dt-sx); dt++;               // xdist between light and this block  (dt==x)
    661661      dx<<=*dt;  dt++;                    // shift makes distance further,
    662662                                          // making light skinner. (dt==xshift)
    663663
    664       dy=abs(*dt-sy); dt++;                   // ydist (dt==y)
     664      dy=lol::abs(*dt-sy); dt++;                   // ydist (dt==y)
    665665      dy<<=*dt;  dt++;                        // (dt==yshift)
    666666
  • abuse/branches/lol/src/lisp/lisp.cpp

    r643 r686  
    678678      if (dy>0)
    679679      {
    680     if (abs(dx)>abs(dy))
     680    if (lol::abs(dx)>lol::abs(dy))
    681681    {
    682682      int32_t a=dx*29/dy;
     
    692692      } else
    693693      {
    694     if (abs(dx)>abs(dy))
    695     {
    696       int32_t a=dx*29/abs(dy);
     694    if (lol::abs(dx)>lol::abs(dy))
     695    {
     696      int32_t a=dx*29/lol::abs(dy);
    697697      if (a>=TBS)
    698698        return 0;
     
    702702    else
    703703    {
    704       int32_t a=abs(dy)*29/dx;
     704      int32_t a=lol::abs(dy)*29/dx;
    705705      if (a>=TBS)
    706706        return 260;
     
    713713      if (dy>0)
    714714      {
    715     if (abs(dx)>abs(dy))
     715    if (lol::abs(dx)>lol::abs(dy))
    716716    {
    717717      int32_t a=-dx*29/dy;
     
    731731      } else
    732732      {
    733     if (abs(dx)>abs(dy))
    734     {
    735       int32_t a=-dx*29/abs(dy);
     733    if (lol::abs(dx)>lol::abs(dy))
     734    {
     735      int32_t a=-dx*29/lol::abs(dy);
    736736      if (a>=TBS)
    737737        return 225-45;
     
    740740    else
    741741    {
    742       int32_t a=abs(dy)*29/abs(dx);
     742      int32_t a=lol::abs(dy)*29/lol::abs(dx);
    743743      if (a>=TBS)
    744744        return 225+45;
     
    24172417    }
    24182418    case SYS_FUNC_ABS:
    2419         ret = LNumber::Create(abs(lnumber_value(CAR(arg_list)->Eval())));
     2419        ret = LNumber::Create(lol::abs(lnumber_value(CAR(arg_list)->Eval())));
    24202420        break;
    24212421    case SYS_FUNC_MIN:
  • abuse/branches/lol/src/menu.cpp

    r682 r686  
    233233      wm->flush_screen();
    234234      main_screen->PutImage(save, ivec2(mx + 1, by1));
    235     } else { Timer tmp; tmp.WaitMs(10); }
     235    } else { Timer tmp; tmp.Wait(0.01f); }
    236236
    237237  } while (!done);
     
    669669        {
    670670            // ECS - Added so that main menu doesn't grab 100% of CPU
    671             Timer tmp; tmp.WaitMs(30);
     671            Timer tmp; tmp.Wait(0.03f);
    672672        }
    673673
  • abuse/branches/lol/src/netcfg.cpp

    r682 r686  
    511511            // pretending to broadcast.
    512512            // ECS - Added so waiting in dialog doesn't use 100% of CPU
    513             Timer tmp; tmp.WaitMs(5);
     513            Timer tmp; tmp.Wait(0.005f);
    514514        }
    515515    }
  • abuse/branches/lol/src/newlight.cpp

    r555 r686  
    438438    else
    439439    {
    440       long dx=abs(fn->x-x)<<fn->xshift;
    441       long dy=abs(fn->y-y)<<fn->yshift;
     440      long dx=lol::abs(fn->x-x)<<fn->xshift;
     441      long dy=lol::abs(fn->y-y)<<fn->yshift;
    442442      long  r2;
    443443      if (dx<dy)
     
    531531    {
    532532      dt++;
    533       int dx=abs(*dt-sx); dt++;
     533      int dx=lol::abs(*dt-sx); dt++;
    534534      dx<<=*dt;  dt++;
    535535
    536       int dy=abs(*dt-sy); dt++;
     536      int dy=lol::abs(*dt-sy); dt++;
    537537      dy<<=*dt;  dt++;
    538538
  • abuse/branches/lol/src/objects.cpp

    r682 r686  
    10441044
    10451045    climb_xvel=old_vx-xvel();
    1046     climb_yvel=-(abs(climb_xvel));        // now try 45 degree slope
     1046    climb_yvel=-(lol::abs(climb_xvel));        // now try 45 degree slope
    10471047    try_move(x,y,climb_xvel,climb_yvel,3);
    10481048
    1049     if (abs(climb_xvel)>0)  // see if he got further by climbing
     1049    if (lol::abs(climb_xvel)>0)  // see if he got further by climbing
    10501050    {
    10511051      blocked=blocked&(~(BLOCKED_LEFT|BLOCKED_RIGHT));
     
    10581058
    10591059      // now put him back on the ground
    1060       climb_yvel=abs(climb_xvel)+5;               // plus one to put him back on the ground
     1060      climb_yvel=lol::abs(climb_xvel)+5;               // plus one to put him back on the ground
    10611061      climb_xvel=0;
    10621062      try_move(x,y,climb_xvel,climb_yvel,1);
     
    14181418
    14191419
    1420   if (abs(xvel()+xacel())>top_speed)
     1420  if (lol::abs(xvel()+xacel())>top_speed)
    14211421  {
    14221422    if (xacel()<0) set_xacel(-top_speed-xvel());
  • abuse/branches/lol/src/particle.cpp

    r682 r686  
    214214    main_screen->GetClip(caa, cbb);
    215215
    216     int t = 1 + Max(abs(p2.x - p1.x), abs(p2.y - p1.y));
     216    int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y));
    217217    int xo = p1.x << 16,
    218218        yo = p1.y << 16,
     
    244244    main_screen->GetClip(caa, cbb);
    245245
    246     int t = 1 + Max(abs(p2.x - p1.x), abs(p2.y - p1.y));
     246    int t = 1 + Max(lol::abs(p2.x - p1.x), lol::abs(p2.y - p1.y));
    247247    int xo = p1.x << 16,
    248248        yo = p1.y << 16,
  • abuse/branches/lol/src/sdlport/sound.cpp

    r634 r686  
    2525#include <cstring>
    2626
     27#include "common.h"
     28
    2729#include <SDL.h>
    2830#include <SDL/SDL_mixer.h>
  • abuse/branches/lol/src/sensor.cpp

    r676 r686  
    3434      b=current_level->attacker(current_object);
    3535    else b=player_list->m_focus;
    36     if (abs(b->x-o->x)<o->xvel() && abs(b->y-o->y)<o->yvel())  // inside area?
     36    if (lol::abs(b->x-o->x)<o->xvel() && lol::abs(b->y-o->y)<o->yvel())  // inside area?
    3737    {
    3838      if (!o->hp())
     
    5050        b=current_level->attacker(current_object);
    5151      else b=player_list->m_focus;
    52       if (abs(o->x-b->x)>o->xacel() || abs(o->y-b->y)>o->yacel())
     52      if (lol::abs(o->x-b->x)>o->xacel() || lol::abs(o->y-b->y)>o->yacel())
    5353        o->set_aistate(0);
    5454    } else o->set_aistate(o->aistate()-1);
Note: See TracChangeset for help on using the changeset viewer.