Example #1
0
int lh_hydracache(lua_State *L) {
  checkArg(L, 2, "hydracache");
  int id = luaInt(1);
  int val = luaInt(2);
  cacheMap(id, val);
  return 1;
  }
Example #2
0
int lh_hydrainfo(lua_State *L) {
  checkArg(L, 2, "hydramap");
  int x = luaInt(1);
  int y = luaInt(2);
  helpAbout(x, y);
  return 0;
  }
Example #3
0
int lh_hydramap(lua_State *L) {
  checkArg(L, 3, "hydramap");
  int x = luaInt(1);
  int y = luaInt(2);
  int m = luaInt(3);
  drawMapLua(L, x, y, m);
  return 1;
  }
Example #4
0
int lh_newimage(lua_State *L) {
  int params = lua_gettop(L);
  if(params != 2 && params != 3) {
    noteyeError(1, "Bad arg to newimage", NULL); 
    return retInt(L, 0);
    }
  Image *i = new Image(luaInt(1), luaInt(2), params == 3 ? luaInt(3) : 0);
  return retObject(L, i);
  }
Example #5
0
int lh_getpixel(lua_State *L) {
  checkArg(L, 3, "getpixel");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);
#ifdef OPENGL
  if(useGL(srcI)) return retInt(L, getpixelGL(srcX, srcY));
#endif
  srcI->setLock(true);
  int res = qpixel(srcI->s, srcX, srcY);
  return retInt(L, res);
  }
Example #6
0
int lh_isoparam(lua_State *L) {
  checkArg(L, 4, "isoparam");
  
  IsoParam *P = new IsoParam;
  P->floor = luaInt(1);
  P->wall  = luaInt(2);
  P->icon  = luaInt(3);
  P->iconh = luaInt(4);
  
  P->build();
  
  return retObject(L, P);
  }
Example #7
0
int lh_setpixel(lua_State *L) {
  checkArg(L, 4, "setpixel");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);
  
#ifdef OPENGL
  if(useGL(srcI)) return 0;
#endif

  srcI->setLock(true);
  qpixel(srcI->s, srcX, srcY) = luaInt(4);
  srcI->changes++;
  return 0;
  }
Example #8
0
int lh_fillimage(lua_State *L) {
  checkArg(L, 6, "fillimage");
  SDL_Rect rect;
  rect.x = luaInt(2);
  rect.y = luaInt(3);
  rect.w = luaInt(4);
  rect.h = luaInt(5);
  int col = luaInt(6);
  Image *img = luaO(1,Image);
#ifdef OPENGL
  if(useGL(img)) fillRectGL(rect.x, rect.y, rect.w, rect.h, col); else
#endif
  SDL_FillRect(img->s, &rect, col);
  img->changes++;
  return 0;
  }
Example #9
0
int lh_delete(lua_State *L) {
  checkArg(L, 1, "delete");
  int i = luaInt(1);
  if(i < 0 || i > size(objs)) {
    noteyeError(17, "delete: no such object", NULL, i);
    return 0;
    }
  deleteobj(i); // todo: reuse this index?
  return 0;
  }
Example #10
0
int lh_iso(lua_State *L) {
  checkArg(L, 2, "isoproject");
  IsoParam *P = luaO(2, IsoParam);
  
  int t0;
  int ti = luaInt(1);
  t0 = addFreeform(distill(ti, spIFloor), P->Floor);
  t0 = addMerge(t0, addFreeform(addRecolor(distill(ti, spIWallL), 0xFF808080, recMult), P->WalL), false);
  t0 = addMerge(t0, addFreeform(addRecolor(distill(ti, spIWallR), 0xFFC0C0C0, recMult), P->WalR), false);
//t0 = addMerge(t0, addFreeform(distill(ti, spIWallL), P->WalL), false);
//t0 = addMerge(t0, addFreeform(distill(ti, spIWallR), P->WalR), false);
  t0 = addMerge(t0, addFreeform(distill(ti, spICeil), P->Ceil), false);
  t0 = addMerge(t0, addFreeform(distill(ti, spIItem), P->Item), false);
  
  return retInt(L, t0);
  // return retInt(L, renderAsIso(luaInt(1), spIFloor | spIItem | spIWallL | spIWallR | spICeil, luaO(2, IsoParam)));
  }
Example #11
0
int lh_imgcopy(lua_State *L) {
  checkArg(L, 8, "fillimage");

  Image *srcI = luaO(1, Image);
  int srcX = luaInt(2);
  int srcY = luaInt(3);

  Image *tgtI = luaO(4, Image);
  int tgtX = luaInt(5);
  int tgtY = luaInt(6);
  
  int six = luaInt(7);
  int siy = luaInt(8);
  
  srcI->setLock(false);
  tgtI->setLock(false);
  
  SDL_Rect srcR; srcR.x = srcX; srcR.y = srcY; srcR.w = six; srcR.h = siy;
  SDL_Rect tgtR; tgtR.x = tgtX; tgtR.y = tgtY; 
  
  SDL_BlitSurface(srcI->s, &srcR, tgtI->s, &tgtR);
  tgtI->changes++;
  return 0;
  }
Example #12
0
int lh_colormix3(lua_State *L) {
  checkArg(L, 3, "colormix3");
  int a = luaInt(1);
  mixcolorAt(a, luaInt(2), luaInt(3));
  return retInt(L, a);
  }
Example #13
0
int lh_vgaset(lua_State *L) {
  checkArg(L, 2, "vgaset");
  vgacol[luaInt(1)] = luaInt(2);
  return 0;
  }
Example #14
0
int lh_vgaget(lua_State *L) {
  checkArg(L, 1, "vgaget");
  return retInt(L, vgacol[luaInt(1)]);
  }
Example #15
0
int lh_colorpartset(lua_State *L) {
  checkArg(L, 3, "colorset");
  int a = luaInt(1);
  part(a, luaInt(2)) = luaInt(3);
  return retInt(L, a);
  }
Example #16
0
int lh_animatehydras(lua_State *L) {
  checkArg(L, 1, "animatehydras");
  extern void hydrapicAnimate(int);
  hydrapicAnimate(luaInt(1));
  return 0;
  }
Example #17
0
int lh_sleep(lua_State *L) {
  SDL_Delay(luaInt(1));
  return 0;
  }
Example #18
0
int lh_setcrashval(lua_State *L) {
  checkArg(L, 1, "setcrashval");
  crashval = luaInt(1);
  return 0;
  }
Example #19
0
int lh_argv(lua_State *L) {
  checkArg(L, 1, "argv");
  int i = luaInt(1);
  if(i < 0 || i >= gargc) return 0;
  return retStr(L, gargv[i]);
  }
Example #20
0
int lh_bXOR(lua_State *L) {
  return retInt(L, luaInt(1) ^ luaInt(2));
  }
Example #21
0
int lh_bAND(lua_State *L) {
  return retInt(L, luaInt(1) & luaInt(2));
  }
Example #22
0
int lh_colormix(lua_State *L) {
  checkArg(L, 2, "colormix");
  int a = luaInt(1);
  mixcolor(a, luaInt(2));
  return retInt(L, a);
  }
Example #23
0
int lh_colorpart(lua_State *L) {
  checkArg(L, 2, "colorpart");
  int a = luaInt(1);
  return retInt(L, part(a, luaInt(2)));
  }