// File: /workspace/github_c_makefile_star2_O1/QwazyWabbitWOS[P]lmctf60/g_spawn.c
// Function: SP_worldspawn
void SP_worldspawn (edict_t *ent)
{
	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	ent->inuse = true;			// since the world doesn't use G_Spawn()
	ent->s.modelindex = 1;		// world model is always index 1

	//---------------

	// reserve some spots for dead player bodies for coop / deathmatch
	InitBodyQue ();

	// set configstrings for items
	SetItemNames ();

	if (st.nextmap)
		strcpy (level.nextmap, st.nextmap);

	// make some data visible to the server

	if (ent->message && ent->message[0])
	{
		gi.configstring (CS_NAME, ent->message);
		strncpy (level.level_name, ent->message, sizeof level.level_name - 1);
	}
	else
		strncpy (level.level_name, level.mapname, sizeof level.level_name);

	if (st.sky && st.sky[0])
		gi.configstring (CS_SKY, st.sky);
	else
		gi.configstring (CS_SKY, "unit1_");

	gi.configstring (CS_SKYROTATE, va("%f", st.skyrotate) );

	gi.configstring (CS_SKYAXIS, va("%f %f %f",
		st.skyaxis[0], st.skyaxis[1], st.skyaxis[2]) );

	gi.configstring (CS_CDTRACK, va("%i", ent->sounds) );

	gi.configstring (CS_MAXCLIENTS, va("%i", (int)(maxclients->value) ) );

	// status bar program
	if (deathmatch->value)
		gi.configstring (CS_STATUSBAR, dm_statusbar);
	else
		gi.configstring (CS_STATUSBAR, single_statusbar);

	//---------------


	// help icon for statusbar
	gi.imageindex ("i_help");
	level.pic_health = gi.imageindex ("i_health");
	gi.imageindex ("help");
	gi.imageindex ("field_3");

	if (!st.gravity)
		gi.cvar_set("sv_gravity", "800");
	else
		gi.cvar_set("sv_gravity", st.gravity);

	snd_fry = gi.soundindex ("player/fry.wav");	// standing in lava / slime

	PrecacheItem (FindItem ("Blaster"));

	gi.soundindex ("player/lava1.wav");
	gi.soundindex ("player/lava2.wav");

	gi.soundindex ("misc/pc_up.wav");
	gi.soundindex ("misc/talk1.wav");

	gi.soundindex ("misc/udeath.wav");

	// gibs
	gi.soundindex ("items/respawn1.wav");

	// sexed sounds
	gi.soundindex ("*death1.wav");
	gi.soundindex ("*death2.wav");
	gi.soundindex ("*death3.wav");
	gi.soundindex ("*death4.wav");
	gi.soundindex ("*fall1.wav");
	gi.soundindex ("*fall2.wav");	
	gi.soundindex ("*gurp1.wav");		// drowning damage
	gi.soundindex ("*gurp2.wav");	
	gi.soundindex ("*jump1.wav");		// player jump
	gi.soundindex ("*pain25_1.wav");
	gi.soundindex ("*pain25_2.wav");
	gi.soundindex ("*pain50_1.wav");
	gi.soundindex ("*pain50_2.wav");
	gi.soundindex ("*pain75_1.wav");
	gi.soundindex ("*pain75_2.wav");
	gi.soundindex ("*pain100_1.wav");
	gi.soundindex ("*pain100_2.wav");

	// sexed models
	// THIS ORDER MUST MATCH THE DEFINES IN g_local.h
	// you can add more, max 15
	gi.modelindex ("#w_blaster.md2");
	gi.modelindex ("#w_shotgun.md2");
	gi.modelindex ("#w_sshotgun.md2");
	gi.modelindex ("#w_machinegun.md2");
	gi.modelindex ("#w_chaingun.md2");
	gi.modelindex ("#a_grenades.md2");
	gi.modelindex ("#w_glauncher.md2");
	gi.modelindex ("#w_rlauncher.md2");
	gi.modelindex ("#w_hyperblaster.md2");
	gi.modelindex ("#w_railgun.md2");
	gi.modelindex ("#w_bfg.md2");
 	gi.modelindex ("#w_plasma.md2"); // SKWiD MOD

	//-------------------

	gi.soundindex ("player/gasp1.wav");		// gasping for air
	gi.soundindex ("player/gasp2.wav");		// head breaking surface, not gasping

	gi.soundindex ("player/watr_in.wav");	// feet hitting water
	gi.soundindex ("player/watr_out.wav");	// feet leaving water

	gi.soundindex ("player/watr_un.wav");	// head going underwater
	
	gi.soundindex ("player/u_breath1.wav");
	gi.soundindex ("player/u_breath2.wav");

	gi.soundindex ("items/pkup.wav");		// bonus item pickup
	gi.soundindex ("world/land.wav");		// landing thud
	gi.soundindex ("misc/h2ohit1.wav");		// landing splash

	gi.soundindex ("items/damage.wav");
	gi.soundindex ("items/protect.wav");
	gi.soundindex ("items/protect4.wav");
	gi.soundindex ("weapons/noammo.wav");

	gi.soundindex ("infantry/inflies1.wav");

	sm_meat_index = gi.modelindex ("models/objects/gibs/sm_meat/tris.md2");
	gi.modelindex ("models/objects/gibs/arm/tris.md2");
	gi.modelindex ("models/objects/gibs/bone/tris.md2");
	gi.modelindex ("models/objects/gibs/bone2/tris.md2");
	gi.modelindex ("models/objects/gibs/chest/tris.md2");
	gi.modelindex ("models/objects/gibs/skull/tris.md2");
	gi.modelindex ("models/objects/gibs/head2/tris.md2");

//
// Setup light animation tables. 'a' is total darkness, 'z' is doublebright.
//

	// 0 normal
	gi.configstring(CS_LIGHTS+0, "m");
	
	// 1 FLICKER (first variety)
	gi.configstring(CS_LIGHTS+1, "mmnmmommommnonmmonqnmmo");
	
	// 2 SLOW STRONG PULSE
	gi.configstring(CS_LIGHTS+2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
	
	// 3 CANDLE (first variety)
	gi.configstring(CS_LIGHTS+3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
	
	// 4 FAST STROBE
	gi.configstring(CS_LIGHTS+4, "mamamamamama");
	
	// 5 GENTLE PULSE 1
	gi.configstring(CS_LIGHTS+5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
	
	// 6 FLICKER (second variety)
	gi.configstring(CS_LIGHTS+6, "nmonqnmomnmomomno");
	
	// 7 CANDLE (second variety)
	gi.configstring(CS_LIGHTS+7, "mmmaaaabcdefgmmmmaaaammmaamm");
	
	// 8 CANDLE (third variety)
	gi.configstring(CS_LIGHTS+8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
	
	// 9 SLOW STROBE (fourth variety)
	gi.configstring(CS_LIGHTS+9, "aaaaaaaazzzzzzzz");
	
	// 10 FLUORESCENT FLICKER
	gi.configstring(CS_LIGHTS+10, "mmamammmmammamamaaamammma");

	// 11 SLOW PULSE NOT FADE TO BLACK
	gi.configstring(CS_LIGHTS+11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
	
	// styles 32-62 are assigned by the light program for switchable lights

	// 63 testing
	gi.configstring(CS_LIGHTS+63, "a");
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x2, 0x118(%rdi)
movl $0x3, 0x108(%rdi)
movl $0x1, %eax
movl %eax, 0x60(%rdi)
movl %eax, 0x28(%rdi)
callq 0x18af0
callq 0x18d80
movq 0x2ea21(%rip), %r15     # 0x69668
movq 0x18(%r15), %rsi
testq %rsi, %rsi
je 0x3ac61
movl $0x88, %edi
addq 0x2f144(%rip), %rdi     # 0x69da0
callq 0x182a0
movq 0x130(%rbx), %rsi
testq %rsi, %rsi
je 0x3ac97
cmpb $0x0, (%rsi)
je 0x3ac97
movq 0x2e987(%rip), %rax     # 0x69600
xorl %edi, %edi
callq *0x30(%rax)
movq 0x130(%rbx), %rsi
movq 0x2f114(%rip), %rdi     # 0x69da0
addq $0x8, %rdi
movl $0x3f, %edx
jmp 0x3acab
movq 0x2f102(%rip), %rsi     # 0x69da0
leaq 0x8(%rsi), %rdi
addq $0x48, %rsi
movl $0x40, %edx
callq 0x181c0
movq (%r15), %rsi
testq %rsi, %rsi
je 0x3acbd
cmpb $0x0, (%rsi)
jne 0x3acc4
leaq 0x1ec53(%rip), %rsi     # 0x59917
movq 0x2e935(%rip), %r14     # 0x69600
movl $0x2, %edi
callq *0x30(%r14)
movq 0x30(%r14), %r12
cvtss2sd 0x8(%r15), %xmm0
leaq 0x1e7c1(%rip), %rdi     # 0x594a6
movb $0x1, %al
callq 0x19340
movl $0x4, %edi
movq %rax, %rsi
callq *%r12
movq 0x30(%r14), %r12
xorps %xmm0, %xmm0
cvtss2sd 0xc(%r15), %xmm0
cvtss2sd 0x10(%r15), %xmm1
cvtss2sd 0x14(%r15), %xmm2
leaq 0x1e789(%rip), %rdi     # 0x594a0
movb $0x3, %al
callq 0x19340
movl $0x3, %edi
movq %rax, %rsi
callq *%r12
movq 0x30(%r14), %r12
movl 0x28c(%rbx), %esi
leaq 0x18b34(%rip), %rbx     # 0x5386e
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19340
movl $0x1, %edi
movq %rax, %rsi
callq *%r12
movq 0x30(%r14), %r12
movq 0x2e7d6(%rip), %rax     # 0x69530
movq (%rax), %rax
cvttss2si 0x20(%rax), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x19340
movl $0x1e, %edi
movq %rax, %rsi
callq *%r12
movq 0x2f142(%rip), %rax     # 0x69ec0
movq (%rax), %rax
xorps %xmm0, %xmm0
ucomiss 0x20(%rax), %xmm0
movq 0x2e789(%rip), %rax     # 0x69518
movq 0x2e73a(%rip), %rcx     # 0x694d0
cmovneq %rax, %rcx
cmovpq %rax, %rcx
movq (%rcx), %rsi
movl $0x5, %edi
callq *0x30(%r14)
leaq 0x1eb6d(%rip), %rdi     # 0x5991e
callq *0x50(%r14)
leaq 0x1d18d(%rip), %rdi     # 0x57f49
callq *0x50(%r14)
movq 0x2efd9(%rip), %rcx     # 0x69da0
movl %eax, 0x12c(%rcx)
leaq 0x1eb4c(%rip), %rdi     # 0x59920
callq *0x50(%r14)
leaq 0x1eb46(%rip), %rdi     # 0x59925
callq *0x50(%r14)
movq 0x48(%r15), %rax
testq %rax, %rax
leaq 0x1de04(%rip), %rsi     # 0x58bf5
cmovneq %rax, %rsi
leaq 0x1ddee(%rip), %rdi     # 0x58bea
callq *0x128(%r14)
leaq 0x1eb23(%rip), %rdi     # 0x5992d
callq *0x48(%r14)
movq 0x2e6eb(%rip), %rcx     # 0x69500
movl %eax, (%rcx)
leaq 0x1c925(%rip), %rdi     # 0x57743
callq 0x189e0
movq %rax, %rdi
callq 0x18790
leaq 0x195e6(%rip), %rdi     # 0x54418
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x5993c
callq *0x48(%r14)
leaq 0x1eb05(%rip), %rdi     # 0x5994d
callq *0x48(%r14)
leaq 0x1be44(%rip), %rdi     # 0x56c97
callq *0x48(%r14)
leaq 0x1d6ec(%rip), %rdi     # 0x5854a
callq *0x48(%r14)
leaq 0x1eaf3(%rip), %rdi     # 0x5995c
callq *0x48(%r14)
leaq 0x1eafb(%rip), %rdi     # 0x5996f
callq *0x48(%r14)
leaq 0x1eafc(%rip), %rdi     # 0x5997b
callq *0x48(%r14)
leaq 0x1eafd(%rip), %rdi     # 0x59987
callq *0x48(%r14)
leaq 0x1eafe(%rip), %rdi     # 0x59993
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x5999f
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x599aa
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x599b5
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x599c0
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x599cb
callq *0x48(%r14)
leaq 0x1eaff(%rip), %rdi     # 0x599d6
callq *0x48(%r14)
leaq 0x1eb02(%rip), %rdi     # 0x599e4
callq *0x48(%r14)
leaq 0x1eb05(%rip), %rdi     # 0x599f2
callq *0x48(%r14)
leaq 0x1eb08(%rip), %rdi     # 0x59a00
callq *0x48(%r14)
leaq 0x1eb0b(%rip), %rdi     # 0x59a0e
callq *0x48(%r14)
leaq 0x1eb0e(%rip), %rdi     # 0x59a1c
callq *0x48(%r14)
leaq 0x1eb11(%rip), %rdi     # 0x59a2a
callq *0x48(%r14)
leaq 0x1eb15(%rip), %rdi     # 0x59a39
callq *0x48(%r14)
leaq 0x1eb19(%rip), %rdi     # 0x59a48
callq *0x40(%r14)
leaq 0x1eb1d(%rip), %rdi     # 0x59a57
callq *0x40(%r14)
leaq 0x1eb21(%rip), %rdi     # 0x59a66
callq *0x40(%r14)
leaq 0x1eb26(%rip), %rdi     # 0x59a76
callq *0x40(%r14)
leaq 0x1eb2d(%rip), %rdi     # 0x59a88
callq *0x40(%r14)
leaq 0x1eb32(%rip), %rdi     # 0x59a98
callq *0x40(%r14)
leaq 0x1eb37(%rip), %rdi     # 0x59aa8
callq *0x40(%r14)
leaq 0x1eb3d(%rip), %rdi     # 0x59ab9
callq *0x40(%r14)
leaq 0x1eb43(%rip), %rdi     # 0x59aca
callq *0x40(%r14)
leaq 0x1eb4c(%rip), %rdi     # 0x59ade
callq *0x40(%r14)
leaq 0x1eb50(%rip), %rdi     # 0x59aed
callq *0x40(%r14)
leaq 0x1eb50(%rip), %rdi     # 0x59af8
callq *0x40(%r14)
leaq 0x1eb53(%rip), %rdi     # 0x59b06
callq *0x48(%r14)
leaq 0x1eb59(%rip), %rdi     # 0x59b17
callq *0x48(%r14)
leaq 0x1eb5f(%rip), %rdi     # 0x59b28
callq *0x48(%r14)
leaq 0x1eb67(%rip), %rdi     # 0x59b3b
callq *0x48(%r14)
leaq 0x1eb70(%rip), %rdi     # 0x59b4f
callq *0x48(%r14)
leaq 0x1eb78(%rip), %rdi     # 0x59b62
callq *0x48(%r14)
leaq 0x1eb82(%rip), %rdi     # 0x59b77
callq *0x48(%r14)
leaq 0x1ca85(%rip), %rdi     # 0x57a85
callq *0x48(%r14)
leaq 0x1d89c(%rip), %rdi     # 0x588a7
callq *0x48(%r14)
leaq 0x1d880(%rip), %rdi     # 0x58896
callq *0x48(%r14)
leaq 0x1bee1(%rip), %rdi     # 0x56f02
callq *0x48(%r14)
leaq 0x1bee7(%rip), %rdi     # 0x56f13
callq *0x48(%r14)
leaq 0x1caff(%rip), %rdi     # 0x57b36
callq *0x48(%r14)
leaq 0x19cad(%rip), %rdi     # 0x54cef
callq *0x48(%r14)
leaq 0x1eb3f(%rip), %rdi     # 0x59b8c
callq *0x48(%r14)
leaq 0x1d502(%rip), %rdi     # 0x5855a
callq *0x40(%r14)
movq 0x2ef8d(%rip), %rcx     # 0x69ff0
movl %eax, (%rcx)
leaq 0x1d662(%rip), %rdi     # 0x586ce
callq *0x40(%r14)
leaq 0x1eb2b(%rip), %rdi     # 0x59ba2
callq *0x40(%r14)
leaq 0x1eb42(%rip), %rdi     # 0x59bc4
callq *0x40(%r14)
leaq 0x1eb5a(%rip), %rdi     # 0x59be7
callq *0x40(%r14)
leaq 0x1d2ba(%rip), %rdi     # 0x58352
callq *0x40(%r14)
leaq 0x1d28c(%rip), %rdi     # 0x5832f
callq *0x40(%r14)
leaq 0x181b1(%rip), %rsi     # 0x5325f
movl $0x320, %edi            # imm = 0x320
callq *0x30(%r14)
leaq 0x1eb4c(%rip), %rsi     # 0x59c0a
movl $0x321, %edi            # imm = 0x321
callq *0x30(%r14)
leaq 0x1eb54(%rip), %rsi     # 0x59c22
movl $0x322, %edi            # imm = 0x322
callq *0x30(%r14)
leaq 0x1eb78(%rip), %rsi     # 0x59c56
movl $0x323, %edi            # imm = 0x323
callq *0x30(%r14)
leaq 0x1eb8b(%rip), %rsi     # 0x59c79
movl $0x324, %edi            # imm = 0x324
callq *0x30(%r14)
leaq 0x1eb88(%rip), %rsi     # 0x59c86
movl $0x325, %edi            # imm = 0x325
callq *0x30(%r14)
leaq 0x1eb9a(%rip), %rsi     # 0x59ca8
movl $0x326, %edi            # imm = 0x326
callq *0x30(%r14)
leaq 0x1eb9c(%rip), %rsi     # 0x59cba
movl $0x327, %edi            # imm = 0x327
callq *0x30(%r14)
leaq 0x1eba9(%rip), %rsi     # 0x59cd7
movl $0x328, %edi            # imm = 0x328
callq *0x30(%r14)
leaq 0x1ebc4(%rip), %rsi     # 0x59d02
movl $0x329, %edi            # imm = 0x329
callq *0x30(%r14)
leaq 0x1ebc5(%rip), %rsi     # 0x59d13
movl $0x32a, %edi            # imm = 0x32A
callq *0x30(%r14)
leaq 0x1ebcf(%rip), %rsi     # 0x59d2d
movl $0x32b, %edi            # imm = 0x32B
callq *0x30(%r14)
movq 0x30(%r14), %rax
leaq 0x18556(%rip), %rsi     # 0x536c8
movl $0x35f, %edi            # imm = 0x35F
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmpq *%rax