MCPcopy Create free account
hub / github.com/diasurgical/devilution / UnPackPlayer

Function UnPackPlayer

Source/pack.cpp:162–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162void UnPackPlayer(PkPlayerStruct *pPack, int pnum, BOOL killok)
163{
164 PlayerStruct *pPlayer;
165 int i;
166 ItemStruct *pi;
167 PkItemStruct *pki;
168
169 pPlayer = &plr[pnum];
170 ClearPlrRVars(pPlayer);
171 pPlayer->WorldX = pPack->px;
172 pPlayer->WorldY = pPack->py;
173 pPlayer->_px = pPack->px;
174 pPlayer->_py = pPack->py;
175 pPlayer->_ptargx = pPack->targx;
176 pPlayer->_ptargy = pPack->targy;
177 pPlayer->plrlevel = pPack->plrlevel;
178 ClrPlrPath(pnum);
179 pPlayer->destAction = ACTION_NONE;
180 strcpy(pPlayer->_pName, pPack->pName);
181 pPlayer->_pClass = pPack->pClass;
182 InitPlayer(pnum, TRUE);
183 pPlayer->_pBaseStr = pPack->pBaseStr;
184 pPlayer->_pStrength = pPack->pBaseStr;
185 pPlayer->_pBaseMag = pPack->pBaseMag;
186 pPlayer->_pMagic = pPack->pBaseMag;
187 pPlayer->_pBaseDex = pPack->pBaseDex;
188 pPlayer->_pDexterity = pPack->pBaseDex;
189 pPlayer->_pBaseVit = pPack->pBaseVit;
190 pPlayer->_pVitality = pPack->pBaseVit;
191 pPlayer->_pLevel = pPack->pLevel;
192 pPlayer->_pStatPts = pPack->pStatPts;
193 pPlayer->_pExperience = SwapLE32(pPack->pExperience);
194 pPlayer->_pGold = SwapLE32(pPack->pGold);
195 pPlayer->_pMaxHPBase = SwapLE32(pPack->pMaxHPBase);
196 pPlayer->_pHPBase = SwapLE32(pPack->pHPBase);
197 if (!killok)
198 if ((int)(pPlayer->_pHPBase & 0xFFFFFFC0) < 64)
199 pPlayer->_pHPBase = 64;
200
201 pPlayer->_pMaxManaBase = SwapLE32(pPack->pMaxManaBase);
202 pPlayer->_pManaBase = SwapLE32(pPack->pManaBase);
203 pPlayer->_pMemSpells = SDL_SwapLE64(pPack->pMemSpells);
204
205 for (i = 0; i < MAX_SPELLS; i++)
206 pPlayer->_pSplLvl[i] = pPack->pSplLvl[i];
207
208 pki = pPack->InvBody;
209 pi = pPlayer->InvBody;
210
211 for (i = 0; i < NUM_INVLOC; i++) {
212 UnPackItem(pki, pi);
213 pki++;
214 pi++;
215 }
216
217 pki = pPack->InvList;
218 pi = pPlayer->InvList;
219

Callers 3

recv_plrinfoFunction · 0.85
pfile_ui_set_hero_infosFunction · 0.85

Calls 6

ClearPlrRVarsFunction · 0.85
ClrPlrPathFunction · 0.85
InitPlayerFunction · 0.85
UnPackItemFunction · 0.85
VerifyGoldSeedsFunction · 0.85
CalcPlrInvFunction · 0.85

Tested by

no test coverage detected