void PrinceEngine::findPoint(int x, int y) { _fpX = x; _fpY = y; if (getPixelAddr(_roomPathBitmap, x, y)) { return; } int fpL = x; int fpU = y; int fpR = x; int fpD = y; while (1) { if (fpD != kMaxPicHeight) { if (getPixelAddr(_roomPathBitmap, x, fpD)) { _fpX = x; _fpY = fpD; break; } fpD++; } if (fpU) { if (getPixelAddr(_roomPathBitmap, x, fpU)) { _fpX = x; _fpY = fpU; break; } fpU--; } if (fpL) { if (getPixelAddr(_roomPathBitmap, fpL, y)) { _fpX = fpL; _fpY = y; break; } fpL--; } if (fpR != _sceneWidth) { if (getPixelAddr(_roomPathBitmap, fpR, y)) { _fpX = fpR; _fpY = y; break; } fpR++; } if (!fpU && (fpD == kMaxPicHeight)) { if (!fpL && (fpR == _sceneWidth)) { break; } } } }
unsigned char* TimgFilterLogoaway::Tplane::getCornerAddr(const TlogoawaySettings *cfg,int corner) { switch (corner) { case TlogoawaySettings::NW: return getPixelAddr(cfg->x,cfg->y); case TlogoawaySettings::NE: return getPixelAddr(cfg->x+cfg->dx-1,cfg->y); case TlogoawaySettings::SW: return getPixelAddr(cfg->x,cfg->y+cfg->dy-1); case TlogoawaySettings::SE: return getPixelAddr(cfg->x+cfg->dx-1,cfg->y+cfg->dy-1); default: return NULL; } }
/* Gets the color of the pixel at position (x,y) and returns it as an unsigned short value (color format) */ unsigned short getColor(int x, int y) { //this is kind of the reverse of drawPixel() on 259macros.h unsigned short color; volatile unsigned short *pPixel; pPixel = getPixelAddr(x,y); color = *pPixel; return color; }
void TimgFilterLogoaway::Tplane::loadLogo(const TlogoawaySettings *cfg,bool withborderN,bool withborderE,bool withborderS,bool withborderW) { int Vstart, Vend; int Hstart, Hend; const unsigned char *buffer=logotempdata; if (withborderN) { Vstart=0; } else { Vstart=1; buffer+=logotempstride; } if (withborderS) { Vend=h; } else { Vend=h-1; } if (withborderW) { Hstart=0; } else { Hstart=1; } if (withborderE) { Hend=w; } else { Hend=w-1; } unsigned char *p=getPixelAddr(cfg->x,cfg->y); for (int i=Vstart; i<Vend; i++) { memcpy(p+Hstart,buffer+(withborderW==false?1:0),Hend-Hstart); buffer+=logotempstride; p+=stride2; } }
inline void CCreatureAnimation::putPixelAt(SDL_Surface * dest, int X, int Y, size_t index, const std::array<SDL_Color, 8> & special) const { if ( X < pos.x + pos.w && Y < pos.y + pos.h) putPixel<bpp>(getPixelAddr(dest, X, Y), palette[index], index, special); }